首页 > 解决方案 > Pinescript v4 更改功能

问题描述

为什么这些实现有不同的结果?

highChange = change(high)
lowChange = change(low)
plot(((change(high) > change(low) and change(high) > 0 ? change(high) : 0)), linewidth = 1, color = color.red)
plot(((highChange > lowChange and highChange > 0 ? highChange : 0)), linewidth = 1, color = color.blue)

在此处输入图像描述

标签: pine-scriptpine-script-v4

解决方案


您的一些计算在条件语句后面,因此它们不会在每个刻度上计算,并且 Pine 会发出警告:

The function 'change' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope.

交易视图警告


推荐阅读