I am working on a fairly simple thing but cannot make it work. The current bar close should be compared to the highest or the lowest price of a lookback period and a shape should be plotted if the closing price exceeds that price.
lookbackPeriod = input(5, "Lookback Period")
var int plotter = na
lowP = lowest(lookbackPeriod)
highP = highest(lookbackPeriod)
if close < lowP or close > highP
plotter := 1
else
plotter := 0
plotshape(plotter, title="shape", location=location.abovebar,
color=color.green, style=shape.triangleup, size=size.small)
Somehow the plotshape function does not accept the series argument and i don't know why. Any hint would be much appreciated.
Thanks!