RicardoSantos

[RS]Linear Regression Bands V1

experiment with linear regression, the purpose was to catch break outs early, but it creates to much visual noise

same as version 0 but with added margin filter and signal to mark entrys
开源脚本

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

免责声明

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

想在图表上使用此脚本?
study(title="[RS]Linear Regression Bands V1", shorttitle="[RS]LRB.V1", overlay=true)
tf1 = input(0.125)
smooth = input(4)
prehh1 = nz(hh1[1], high)
prell1 = nz(ll1[1], low)

hh1 = close >= prehh1 ? high : prehh1 - sma(abs(change(high, 1)*tf1), smooth)
ll1 = close <= prell1 ? low : prell1 + sma(abs(change(low, 1)*tf1), smooth)
midline = avg(hh1, ll1)
plot(midline, style=cross, color=black, linewidth=1)
ph1 = plot(hh1, style=line, color=black, linewidth=1)
pl1 = plot(ll1, style=line, color=black, linewidth=1)

margin = input(30) * syminfo.mintick
signalcolor = high-margin > hh1 ? maroon : low+margin < ll1 ? green : gray
signal = high-margin > hh1 ? high+margin : low+margin < ll1 ? low-margin : na
plot(signal, style=circles, color=signalcolor, linewidth=4)