Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study(title="Stochastic RSI", shorttitle="Stoch RSI", format=format.price, precision=2)
- smoothK = input(3, "K", minval=1)
- smoothD = input(3, "D", minval=1)
- lengthRSI = input(22, "RSI Length", minval=1)
- lengthStoch = input(22, "Stochastic Length", minval=1)
- src = input(close, title="RSI Source")
- rsi1 = rsi(src, lengthRSI)
- k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
- d = sma(k, smoothD)
- plot(k, "K", color=#2962FF)
- plot(d, "D", color=#FF6D00)
- h0 = hline(80, "Upper Band", color=#787B86)
- h1 = hline(20, "Lower Band", color=#787B86)
- fill(h0, h1, color=color.rgb(33, 150, 243, 90), title="Background")
- smoothK2 = input(3, "2K", minval=1)
- smoothD2 = input(3, "2D", minval=1)
- lengthRSI2 = input(14, "RSI Length", minval=1)
- lengthStoch2 = input(14, "Stochastic Length", minval=1)
- src2 = input(close, title="RSI Source")
- rsi12 = rsi(src2, lengthRSI2)
- k2 = sma(stoch(rsi12, rsi12, rsi12, lengthStoch2), smoothK2)
- d2 = sma(k2, smoothD2)
- plot(k2, "K2", color=#2962FF)
- plot(d2, "D2", color=#FF6D00)
Advertisement
Add Comment
Please, Sign In to add comment