Advertisement
lazybeartv

RSIBands v2.0 (BizkitBR req)

Jun 1st, 2016
1,733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. //
  2. // @version 2
  3. // @title RSIBands v2.0 (BizkitBR req)
  4. // @author LazyBear
  5. // List of all my indicators: http://bit.ly/1LQaPK8
  6. //
  7. study("RSI Bands [LazyBear]", shorttitle="RSIBANDS2_LB", overlay=true)
  8. obLevel = input(70, title="RSI Overbought")
  9. osLevel = input(30, title="RSI Oversold")
  10. length = input(14, title="RSI Length")
  11. src=close
  12. ep = 2 * length - 1
  13. auc = ema( max( src - src[1], 0 ), ep )
  14. adc = ema( max( src[1] - src, 0 ), ep )
  15. x1 = (length - 1) * ( adc * obLevel / (100-obLevel) - auc)
  16. ub = iff( x1 >= 0, src + x1, src + x1 * (100-obLevel)/obLevel )
  17. x2 = (length - 1) * ( adc * osLevel / (100-osLevel) - auc)
  18. lb = iff( x2 >= 0, src + x2, src + x2 * (100-osLevel)/osLevel )
  19. cent=avg(ub,lb)
  20. ux=plot( ub, title="Resistance", color=red, linewidth=2)
  21. lx=plot( lb, title="Support", color=green, linewidth=2)
  22. mx=plot( cent, title="RSI Midline", color=gray, linewidth=1)
  23. fill(ux, mx, green)
  24. fill(lx, mx, red)
  25.  
  26. markOBOS=input(true, title="Mark OB/OS bars")
  27. colorBars=input(false, title="Color bars based on region")
  28.  
  29. c_rgn = colorBars?((src>cent)?#7CFC00:#FF6347):na
  30. c_obos=markOBOS?(((src>=ub) or (src<=lb)) ?fuchsia:c_rgn):c_rgn
  31. barcolor(c_obos)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement