How to code a tradingview indicator that calculate How much the price have changed on each green candles streak with plotting the result
And samething for red candles straks
candles streak : means no opposite candles in between expmle: three green candles on a row
This is my script so far
`
indicator(title=”price change streak”, overlay=false)
pcpb = close[1] – close /close[1] *100
if pcpb >0
pc = pc + pcpb
plot(pc, style=plot.style_histogram, linewidth=4,
color=color.green)
pc := 0
else
npc = npc + pcpb
plot(npc, style=plot.style_histogram, linewidth=4,
color=color.red)
npc := 0
type here
`
Hanafi Yacine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.