【问题标题】:Convert Think script (within x bars) to pine script将 Think 脚本(在 x 条内)转换为 pine 脚本
【发布时间】:2023-02-10 15:55:28
【问题描述】:

我正在尝试将 Think 脚本转换为 pine 脚本。

这是我要转换的 Think Script...

      High crosses above Highest("data" = HIGH, "length" = 240)[1] within 60 bars

我想知道如何转换 pine 脚本的“60 条以内”部分。

我想在松脚本中实现的是......

      x condition has happened within last x bars

      or

      Condition "within 60 bars"

【问题讨论】:

    标签: pine-script pine-script-v5 trading pine-script-v4 thinkscript


    【解决方案1】:

    您可以使用 ta.barssince() 函数计算自上次条件为 true 以来的柱数,然后将其与 60 进行比较:

    counter = ta.barssince(yourCondition)
    if counter < 60
        // do something
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-07
      • 1970-01-01
      • 2022-10-15
      相关资源
      最近更新 更多