chentz

Basic MA

All-in-one basic indicators:
- MA Fast (12)
- MA Medium (26)
- MA Slow (200)
- Parabolic SAR www.investopedia.com...hnical/02/042202.asp
- Dynamic Fibonnaci channel with 2 channels - www.forexstrategiesr...ibo-dynamic-channel/
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?
//@version=2
study("Basic MA", overlay=true)

maFastLen = input(title="Def. MA Fast",defval=12) //12
maMediumLen = input(title="Def. MA Medium",defval=26) //26
maSlowLen = input(title="Def. MA Slow",defval=200) //200
FIB1 = input(title="Fib. Level 1",defval=0.382) //0.382
FIB2 = input(title="Fib. Level 2",defval=0.618) //0.618
src = input(close, "Source") //close

FLEMA = input(title="MA Fast EMA?",defval=false)
MLEMA = input(title="MA Medium EMA?",defval=false)
SLEMA = input(title="MA Slow EMA?",defval=false)
BRFIB = input(title="Fib Ref Base Med?", defval=false)

maFast = FLEMA ? ema(src,maFastLen) : sma(src,maFastLen)
maMedium= MLEMA ? ema(src,maMediumLen) : sma(src,maMediumLen)
maSlow = SLEMA ? ema(src,maSlowLen) : sma(src,maSlowLen)

plot(maFast,title="EMA Fast Close", style=line,color=maroon)
plot(maMedium,title="EMA Medium Close", style=line,color=purple)
plot(maSlow,title="EMA Slow Close", style=line,color=teal)

plot(sar(0.02,0.02, 0.2),title="SAR Close", style=cross,color=blue)

BFR = BRFIB ? (maFast+maSlow)/2 : abs(maFast - maSlow)

//F1 = BFR*0.236
//F2 = BFR*0.382
//F3 = BFR*0.618
//F4 = BFR*0.764
F1 = BFR*FIB1
F2 = BFR*FIB2

R1 = maFast+F1
R2 = maFast+F2
//R3 = maFast+F3
//R4 = maFast+F4

S1 = maFast-F1
S2 = maFast-F2
//S3 = maFast-F3
//S4 = maFast-F4

sigOverB = (src > R1) ? S1 : na
sigOverS = (src < S1) ? R1 : na
sigData = sigOverB ? sigOverB : sigOverS ? sigOverS : na

plot(sigData,title="Signal R/S", style=cross, linewidth=1,color=sigOverB ? red : green)

//plotshape(sigOverB, style=shape.triangledown,location=location.top, color=red)
//plotshape(sigOverS, style=shape.triangleup,location=location.bottom, color=green)

pR2 = plot(R2,title="Fib R2", style=line, color=#74B581)
pS2 = plot(S2,title="Fib S2", style=line, color=#E87D6F)

pR1 = plot(R1,title="Fib R1", style=line, color=white)
pS1 = plot(S1,title="Fib S1", style=line, color=white)

//plot(R2,title="Fib R2", style=line, color=#74B581)
//plot(R3,title="Fib R3", style=line, color=#74B581)
//plot(S2,title="Fib S2", style=line, color=#E87D6F)
//plot(S3,title="Fib S3", style=line, color=#E87D6F)
//pR4 = plot(R4,title="Fib R4", style=line, color=#74B581)
//pS4 = plot(S4,title="Fib S4", style=line, color=#E87D6F)

fill(pR1,pR2,color=green,transp=90)
fill(pS1,pS2,color=red,transp=90)