# [RS]Linear Regression Bands V2

543 0
EXPERIMENTAL:
added titles to inputs and plots for better understanding what is what( DCC             )
M = middle, T = top, B = bottom, S = signal.
```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)```
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter