首页 > 解决方案 > 如何在 pine 脚本中获取特殊栏的编号

问题描述

我正在尝试获取 pine 脚本中的条数。例如,我想为每 24 个条找到最高条。我需要那个栏的数量而不是价值。我试过

Highest(high,24)

但它返回值!!!!

标签: pine-script

解决方案


highesbars()

//@version=4
study("")
hi = highest(high,24)
hiIndex = - highestbars(high, 24)
hiBarIndex = bar_index[hiIndex]

plot(hi, "hi")
plot(hiIndex, "hiIndex")
plot(hiBarIndex, "hiBarIndex")

推荐阅读