RicardoSantos

[RS]Price Linear Sequence Counter

341 0 44
Simple green/red sequence counter, also gives current highest achieved sequence(black lines).
Remove from Favorite Scripts Add to Favorite Scripts
study(title="[RS]Price Linear Sequence Counter", shorttitle="[RS]PLSC.V0")
length = input(24)

sa = open

sb = close

//difrange = abs(sa-sb)
posdifrange = sb-sa >= 0 ? sb-sa : 0
negdifrange = sb-sa <= 0 ? sb-sa : 0

//dfappex = nz(dfappex[1]) <= difrange ? difrange : nz(dfappex[1])

poslinearsequence = posdifrange > 0 ? nz(poslinearsequence[1]) + 1 : 0
neglinearsequence = negdifrange < 0 ? nz(neglinearsequence[1]) - 1 : 0

plinappex = nz(plinappex[1]) <= poslinearsequence ? poslinearsequence : nz(plinappex[1])
nlinappex = nz(nlinappex[1]) >= neglinearsequence ? neglinearsequence : nz(nlinappex[1])

plot(poslinearsequence, color=green, style=columns)
plot(neglinearsequence, color=red, style=columns)
//plot(difrange)
//colorf(v, c) => v != 0 ? c : na
//plot(posdifrange, color=colorf(posdifrange, green), style=circles, linewidth=2)
//plot(negdifrange, color=colorf(negdifrange, red), style=circles, linewidth=2)

plot(plinappex, color=black)
plot(nlinappex, color=black)
hline(0, color=black)
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out