I know that the script below will plot the highest high and lowest low, but how do I do the exact same kind of plot but using the highest bar/candle and lowest bar/candle?
If I just plot the close it will plot the bottom of a descending bar, and the top of an ascending. I want the top of either ascending or descending, and the bottom of either on two separate lines. Help is greatly appreciated. I am trying to figure this stuff out but I am struggling with this.
I really wish it had a var = highest bar (high, length) function, that would make life simple
//@version=4
study("My Script",overlay=true)
lookbackres= input(3,title="Res Lookback")
lookbacksup= input(3,title="Sup Lookback")
res=highest(high,lookbackres)
sup=lowest(low,lookbacksup)
plot(series=res, color=color.green, linewidth=2)
plot(series=sup, color=color.red, linewidth=2)
question from:https://stackoverflow.com/questions/65910436/pine-script-question-highest-high-versus-highest-close