Advertisement
gustavcaves

3MA + Bandas Rsi + BB

Nov 16th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. //@version=4
  2. study(title="Moving Average", shorttitle="3MA", overlay=true)
  3. len = input(8, minval=1, title="Length")
  4. src = input(close, title="Source")
  5. out = sma(src, len)
  6. plot(out, color=color.blue, title="MA")
  7.  
  8. len20 = input(20, minval=1, title="Length")
  9. src20 = input(close, title="Source")
  10. out20 = sma(src20, len20)
  11. plot(out20, color=color.orange, title="MA")
  12.  
  13. len200 = input(156, minval=1, title="Length")
  14. src200 = input(close, title="Source")
  15. out200 = sma(src200, len200)
  16. plot(out200, color=color.purple, title="MA")
  17.  
  18.  
  19. show_rsirs = input(true, title="RSIBANDS_LB")
  20. //study("RSI Bands [LazyBear]", shorttitle="RSIBANDS_LB", overlay=true)
  21. obLevel = input(70, title="RSI Overbought")
  22. osLevel = input(30, title="RSI Oversold")
  23. lengthxx = input(14, title="RSI Length")
  24. src1 = input(close, title="Source")
  25. ep = 2 * lengthxx - 1
  26. auc = ema( max( src1 - src1[1], 0 ), ep )
  27. adc = ema( max( src1[1] - src1, 0 ), ep )
  28. x1 = (lengthxx - 1) * ( adc * obLevel / (100-obLevel) - auc)
  29. ub = iff( x1 >= 0, src1 + x1, src1 + x1 * (100-obLevel)/obLevel )
  30. x2 = (lengthxx - 1) * ( adc * osLevel / (100-osLevel) - auc)
  31. lb = iff( x2 >= 0, src1 + x2, src1 + x2 * (100-osLevel)/osLevel )
  32.  
  33. rsiup=plot(not show_rsirs ? na : ub, title="Resistance", color=color.red, linewidth=2, transp=30)
  34. rsidw=plot(not show_rsirs ? na : lb, title="Support", color=color.green, linewidth=2, transp=30)
  35. plot(not show_rsirs ? na : avg(ub, lb), title="RSI Midline", color=color.gray, linewidth=1)
  36. fill(rsiup, rsidw, color = color.blue, transp=100)
  37.  
  38.  
  39.  
  40. //@version=4
  41. //study(shorttitle="BB", title="Bollinger Bands", overlay=true)
  42. length = input(20, minval=1)
  43. srcbb = input(close, title="Source")
  44. mult = input(2.0, minval=0.001, maxval=50)
  45. basis = sma(srcbb, length)
  46. dev = mult * stdev(srcbb, length)
  47. upper = basis + dev
  48. lower = basis - dev
  49. plot(basis, color=color.red)
  50. p1 = plot(upper, color=color.blue)
  51. p2 = plot(lower, color=color.blue)
  52. fill(p1, p2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement