Pinescript v4 改函数

Pinescript v4 change function

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

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 会发出警告:

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.