Reputation: 13
I'm trying to get number of a bar in pine script. For example i want find the highest bar for each 24 bars. And i need the number of that bar not the value. I tried
Highest(high,24)
But it returns value!!!!
Upvotes: 0
Views: 238
Reputation: 8789
See 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")
Upvotes: 0