indicator · own pane · open source

Adaptive Stochastic RSI

Deepwick · @deepwickv1Updated 2 Oct 2026▲ 0 users
Running…
Loading chart…

About

Adaptive Stochastic RSI — feeds an adaptive-length RSI into a stochastic formula, then smooths with a 3-bar SMA. Combines Kaufman's adaptation with Connors' StochRSI.

  • 20/80 extremes work the same; the signals are cleaner.

Source code

//@version=5
indicator("Adaptive Stochastic RSI", overlay=false)
len = input.int(14, "Base length", minval=5, maxval=100)
cumAbs = ta.cum(math.abs(ta.change(close)))
sumAbs = cumAbs - cumAbs[len]
er = math.abs(close - close[len]) / math.max(sumAbs, 0.0001)
aLen = na(er) ? 14 : math.max(5, math.min(200, math.round(len * (1 - er / 2))))
rsi = ta.rsi(close, aLen)
srsi = 100 * (rsi - ta.lowest(rsi, aLen)) / math.max(ta.highest(rsi, aLen) - ta.lowest(rsi, aLen), 0.0001)
stochRsi = ta.sma(srsi, 3)
hline(80, "OB", color=color.gray)
hline(20, "OS", color=color.gray)
p_StochRSI = plot(stochRsi, "StochRSI", color=color.blue, linewidth=2)
alertcondition(ta.crossover(stochRsi, 20), "Up from OS", "Adaptive stoch RSI crossed above 20")
alertcondition(ta.crossunder(stochRsi, 80), "Down from OB", "Adaptive stoch RSI crossed below 80")

Comments

No comments yet.

Sign in to comment.