I want to plot/draw a horizontal line of the previous closing price and extend to right till it is crossed. I need to extend all the closing prices which are not crossed. Time frame is any timeframe.
I am new to pine script coding and getting error while trying different things.
Please help
I tried this
var float last_pdc = na
if na(last_pdc) or close > last_pdc or close < last_pdc
last_pdc := pdc
d_pdc = plot(dpdc ? last_pdc : na, color=color.new(#c8055a, transp=40), title='PDC', linewidth=2, style=plot.style_cross, offset=offset)
but this is plotting only one and not multiple.
New contributor
aganesan99 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.