为了一致性,控制台输出应该在每次计算时调用该函数?

cry*_*r76 6 trading pine-script

当我添加到图表或保存时,我的脚本最近刚刚开始在控制台中显示这些行。

"The function 'anonym_function_10' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope."
"The function 'anonym_function_11' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope." 
Run Code Online (Sandbox Code Playgroud)

需要一些帮助来理解这一点,代码是否会因准确性而受到影响,或者这可能是将来可能出现的问题?解决这个问题的解决方案是什么?

// @version=4
f_top_fractal(src) => src[4] < src[2] and src[3] < src[2] and src[2] > src[1] and src[2] > src[0]
f_bot_fractal(src) => src[4] > src[2] and src[3] > src[2] and src[2] < src[1] and src[2] < src[0]
f_fractalize(src) => f_top_fractal(src) ? 1 : f_bot_fractal(src) ? -1 : 0
Run Code Online (Sandbox Code Playgroud)

最后一行是有问题的......

小智 5

如果您的代码是这样的,您很可能会收到此错误。

mav = na(xem[1]) ? sma(src, len) : (xem[1] / len)`
Run Code Online (Sandbox Code Playgroud)

尝试这样...

_sma= sma(src, len)
mav = na(xem[1]) ? _sma : (xem[1] / len)
Run Code Online (Sandbox Code Playgroud)