'Indicator value for specific bar index
I have specific bar index from the beginning of the chart (ex. 6500). How can I get atr value for this bar?
Thank you in advance.
Solution 1:[1]
Use an if condition and store the value if the bar_index is 6500.
//@version=5
indicator("My script")
_atr = ta.atr(14)
var float atr6500 = na
if (bar_index == 6500)
atr6500 := _atr
plot(_atr)
plot(atr6500, color=color.green)
plot(bar_index, color=color.yellow)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vitruvius |

