RicardoSantos

[RS]Price Linear Sequence Counter

Simple green/red sequence counter, also gives current highest achieved sequence(black lines).
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
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)