Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- study(title="CCI+EMA", shorttitle="MS_SQUEEZE_CCI")
- length1 = input(40, minval=1, title="CCI")
- ma_length = input(6, minval=5, title="MA")
- B_out = input(12,title='Breakout Length')
- src = input(close, title="Source")
- ma1 = sma(src, length1)
- cci1 = (src - ma1) / (0.015 * dev(src, length1))
- ma1ema=ema(cci1, ma_length)
- plot(cci1, linewidth=2)
- plot(ma1ema, color=red, linewidth=1)
- plotColr = (cci1 > ema(cci1, ma_length)) ? lime : black
- plotCCIEMA = plot(series=cci1, color=plotColr, linewidth=2)
- band5 = hline(300, color=red)
- band0 = hline(200, title="Overbought", color=red)
- band1 = hline(100, color=black)
- band2 = hline(0,title="zero")
- band3 = hline(-100, color=black)
- band4 = hline(-200, title="Oversold", color=green)
- band6 = hline(-300, color=green)
- //-------------
- fill(band0, band4, color=blue, transp=95)
- fill(band4, band6, color=lime, transp=95)
- fill(band0, band5, color=red, transp=95)
- //-------------
- Long_all = cci1 > ema(cci1, ma_length)
- Short_all= cci1 < ema(cci1, ma_length)
- Long_Bo = ma1ema>=ma1ema[1] and ma1ema>=B_out
- Short_Bo= ma1ema<=ma1ema[1] and ma1ema<=-B_out
- //bgcolor(cci1>=100?lime:cci1<=-100?fuchsia:na,transp=75)
- bgcolor(Long_all and not Long_Bo?lime:Short_all and not Short_Bo?red:na,transp=80)
- bgcolor(Long_Bo?green:Short_Bo?maroon:na,transp=50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement