finallynitin

RSI+9EMA

Dec 14th, 2020 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © equity4life
  3.  
  4. //@version=4
  5. study(title="RSI Equity4life", shorttitle="RSI+9EMA", format=format.price, precision=2, resolution="")
  6.  
  7. //RSI
  8. len = input(14, minval=1, title="Length")
  9. src = input(close, "Source", type = input.source)
  10. up = rma(max(change(src), 0), len)
  11. down = rma(-min(change(src), 0), len)
  12. rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
  13. plot(rsi, "RSI", color=color.black)
  14.  
  15. //Midline
  16. th = input(50, title="threshold")
  17. hline(th, title="Middle Line", color=color.black, linestyle=hline.style_dashed)
  18.  
  19. //Bands
  20. band2 = hline(60, "Upper Band", color=#4CAF50, linestyle=hline.style_dashed)
  21. band1 = hline(40, "Lower Band", color=#FF5252, linestyle=hline.style_dashed)
  22.  
  23. fill(band1, band2, color=color.fuchsia, transp=90)
  24.  
  25. //Moving Average
  26. nine = ema(rsi(close, 14), 9)
  27. plot(nine, color=#FF9800, linewidth=1, title='EMA')
Add Comment
Please, Sign In to add comment