'How to get value of High of last bar where plotshape was true?
Im trying to return the High of the last bar in which conditions were met for a signal. For example whenever "buyretracebar" has plotted to chart, i want to get the value of the high for that bar. thanks!
buyretracebar=sl and iff(cloud1, buycloud1filteron, buycloud1filteroff)
plotshape(buyretracebar, title = "Long Bar")
Solution 1:[1]
You can do that by using a var variable and if check.
var float highAtRetrace = na
if buyretracebar
highAtRetrace := high
Or you can use ta.valuewhen()
ta.valuewhen(buyretracebar, high, 0)
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 |
