soru

LRx2 v3

23
LRx2 v3
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study("LRx2 v3",overlay=true)
Len_ma=input(56,title="len")
m=input(title="LR multiplier",defval=1)
Len_LR=Len_ma*m
LR_offset=input(0)
ema= input(defval=false,title='use ema instead of sma?')
ma1 = ema ? ema(high,Len_ma) : sma(high,Len_ma)
ma2 = ema ? ema(low,Len_ma) : sma(low,Len_ma)
//m1=plot(show_2xMA ? ma1:na,color=gray, linewidth=2)
//m2=plot(show_2xMA ? ma2: na,color=gray, linewidth=2)
mm = ema ? ema(close,Len_ma) : sma(close,Len_ma)
mm_p = plot(mm,style=areabr,transp=100)
mm_p1 = plot(mm,style=line,transp=100,color=black)
z1=linreg(high,Len_LR,LR_offset)
z2=linreg(low,Len_LR,LR_offset)
z3=linreg(close,Len_LR,LR_offset)
z11=z1>ma1 ? z1-2*(z1-ma1) : z2+2*(ma2-z2)
swing=plot(rma(z11,10),style=areabr,transp=100)
fill(swing,mm_p,color=black,transp=80)