Advertisement
aaahopper

MS_SQUEEZE_CCI

Nov 4th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | None | 0 0
  1. //@version=3
  2.  
  3. study(title="CCI+EMA", shorttitle="MS_SQUEEZE_CCI")
  4. length1 = input(40, minval=1, title="CCI")
  5. ma_length = input(6, minval=5, title="MA")
  6. B_out = input(12,title='Breakout Length')
  7. src = input(close, title="Source")
  8. ma1 = sma(src, length1)
  9. cci1 = (src - ma1) / (0.015 * dev(src, length1))
  10. ma1ema=ema(cci1, ma_length)
  11. plot(cci1, linewidth=2)
  12. plot(ma1ema, color=red, linewidth=1)
  13.  
  14. plotColr = (cci1 > ema(cci1, ma_length)) ? lime : black
  15. plotCCIEMA = plot(series=cci1, color=plotColr, linewidth=2)
  16.  
  17. band5 = hline(300, color=red)
  18. band0 = hline(200, title="Overbought", color=red)
  19. band1 = hline(100, color=black)
  20. band2 = hline(0,title="zero")
  21. band3 = hline(-100, color=black)
  22. band4 = hline(-200, title="Oversold", color=green)
  23. band6 = hline(-300, color=green)
  24. //-------------
  25. fill(band0, band4, color=blue, transp=95)
  26. fill(band4, band6, color=lime, transp=95)
  27. fill(band0, band5, color=red, transp=95)
  28. //-------------
  29. Long_all = cci1 > ema(cci1, ma_length)
  30. Short_all= cci1 < ema(cci1, ma_length)
  31. Long_Bo = ma1ema>=ma1ema[1] and ma1ema>=B_out
  32. Short_Bo= ma1ema<=ma1ema[1] and ma1ema<=-B_out
  33.  
  34.  
  35. //bgcolor(cci1>=100?lime:cci1<=-100?fuchsia:na,transp=75)
  36. bgcolor(Long_all and not Long_Bo?lime:Short_all and not Short_Bo?red:na,transp=80)
  37. bgcolor(Long_Bo?green:Short_Bo?maroon:na,transp=50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement