【问题标题】:Pinescript v4 change functionPinescript v4 更改功能
【发布时间】:2021-11-15 18:21:30
【问题描述】:

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

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-script pine-script-v4


    【解决方案1】:

    您的一些计算在条件语句之后,因此它们不会在每个刻度上计算,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.

    【讨论】:

    • 有趣的是,我没有收到针对 v4 和 v5 的任何警告。可以分享一下你的测试代码吗?
    猜你喜欢
    • 2022-12-05
    • 2022-12-26
    • 2017-07-30
    • 2021-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-30
    相关资源
    最近更新 更多