indicator · own pane · open source
Stochastic RSI
Running…
Loading chart…
About
Stochastic RSI applies the Stochastic kernel to RSI itself, so it sits between 0 and 1 (or 0-100 scaled). Far more sensitive than a regular Stochastic.
- Useful for short-term reversals on majors and BTCUSD.
- %K crossing %D in the lower band is a clean entry trigger.
- Raise
RSI Lengthto slow it down.
Source code
//@version=5
indicator("Stochastic RSI", overlay=false)
len = input.int(14, "RSI Length", minval=2, maxval=100)
klen = input.int(3, "%K Smoothing", minval=1, maxval=50)
dlen = input.int(3, "%D Smoothing", minval=1, maxval=50)
src = input.source("close", "Source")
rsi1 = ta.rsi(src, len)
lo = ta.lowest(rsi1, len)
hi = ta.highest(rsi1, len)
srsi = 100 * (rsi1 - lo) / (hi - lo)
k = ta.sma(srsi, klen)
d = ta.sma(k, dlen)
hline(80, "Overbought", color=color.gray, linestyle=hline.style_dashed)
hline(20, "Oversold", color=color.gray, linestyle=hline.style_dashed)
p_Stoch_RSI = plot(k, "Stoch RSI", color=color.blue, linewidth=2)
p_Signal = plot(d, "Signal", color=color.orange)
alertcondition(ta.crossover(k, d) and k < 20, "StochRSI cross up in OS", "Stoch RSI crossed signal in oversold")
alertcondition(ta.crossunder(k, d) and k > 80, "StochRSI cross down in OB", "Stoch RSI crossed signal in overbought")
No comments yet.
Sign in to comment.