RicardoSantos

[RS]Linear Regression Bands V2

EXPERIMENTAL:
added titles to inputs and plots for better understanding what is what(DCC)
M = middle, T = top, B = bottom, S = signal.
สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
study(title="[RS]Linear Regression Bands V2", shorttitle="LRB", overlay=true)
decay_ratio = input(title='Decay ratio:', type=float, defval=0.125)
smooth = input(title='Smoothing:', type=integer, defval=4)

prehh1 = nz(hh1[1], high)
prell1 = nz(ll1[1], low)

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

margin = input(title='Signal margin:', type=float, defval=30.0) * 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(title='S', series=signal, style=circles, color=signalcolor, linewidth=4)