xmd79

Stochastic RSI

Jan 23rd, 2022
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. //@version=4
  2. study(title="Stochastic RSI", shorttitle="Stoch RSI", format=format.price, precision=2)
  3. smoothK = input(3, "K", minval=1)
  4. smoothD = input(3, "D", minval=1)
  5. lengthRSI = input(22, "RSI Length", minval=1)
  6. lengthStoch = input(22, "Stochastic Length", minval=1)
  7. src = input(close, title="RSI Source")
  8. rsi1 = rsi(src, lengthRSI)
  9. k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
  10. d = sma(k, smoothD)
  11. plot(k, "K", color=#2962FF)
  12. plot(d, "D", color=#FF6D00)
  13. h0 = hline(80, "Upper Band", color=#787B86)
  14. h1 = hline(20, "Lower Band", color=#787B86)
  15. fill(h0, h1, color=color.rgb(33, 150, 243, 90), title="Background")
  16.  
  17.  
  18. smoothK2 = input(3, "2K", minval=1)
  19. smoothD2 = input(3, "2D", minval=1)
  20. lengthRSI2 = input(14, "RSI Length", minval=1)
  21. lengthStoch2 = input(14, "Stochastic Length", minval=1)
  22. src2 = input(close, title="RSI Source")
  23. rsi12 = rsi(src2, lengthRSI2)
  24. k2 = sma(stoch(rsi12, rsi12, rsi12, lengthStoch2), smoothK2)
  25. d2 = sma(k2, smoothD2)
  26. plot(k2, "K2", color=#2962FF)
  27. plot(d2, "D2", color=#FF6D00)
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment