GlossaryStochastic RSI

Stochastic RSI

The Stoch RSI applies the Stochastic formula not to the price but to the RSI. It shows where the current RSI sits within its own range over recent candles, and so it reacts much faster than the RSI itself.

Calculation

The calculation has two stages followed by two smoothings. CtC_t is the close, rr the RSI length, mm the Stochastic length, aa the %K smoothing and bb the %D smoothing.

Stage 1: the RSI

A Wilder RSI on the closes. Gains Gt=max⁡(Ct−Ct−1, 0)G_t = \max(C_t - C_{t-1},\ 0) and losses Lt=max⁡(Ct−1−Ct, 0)L_t = \max(C_{t-1} - C_t,\ 0) are smoothed with the factor 1/r1/r; the starting value is the simple mean of the first rr values:

Gˉt=(r−1) Gˉt−1+Gtr,RSIt=100−1001+Gˉt/Lˉt\bar G_t = \frac{(r-1)\,\bar G_{t-1} + G_t}{r}, \qquad \mathrm{RSI}_t = 100 - \frac{100}{1 + \bar G_t / \bar L_t}

Lˉt\bar L_t is formed the same way; at Lˉt=0\bar L_t = 0 the RSI is 100. Unlike in the standalone RSI, the very first candle already counts here as a change of zero. The RSI therefore begins one candle earlier, which only affects the first values at the start of the history.

Stage 2: the Stochastic of the RSI

Highest and lowest RSI of the last mm candles, including the current one:

StochRSIt=100⋅RSIt−min⁡0≤i<mRSIt−imax⁡0≤i<mRSIt−i−min⁡0≤i<mRSIt−i\mathrm{StochRSI}_t = 100 \cdot \frac{\mathrm{RSI}_t - \min\limits_{0 \le i < m} \mathrm{RSI}_{t-i}}{\max\limits_{0 \le i < m} \mathrm{RSI}_{t-i} - \min\limits_{0 \le i < m} \mathrm{RSI}_{t-i}}

It is only calculated once the RSI exists for all mm candles of the window, not with a half-filled window. If the RSI was the same across the whole window, there is no value and the line pauses.

Smoothing

%Kt=1a∑i=0a−1StochRSIt−i,%Dt=1b∑i=0b−1%Kt−i\%K_t = \frac{1}{a}\sum_{i=0}^{a-1} \mathrm{StochRSI}_{t-i}, \qquad \%D_t = \frac{1}{b}\sum_{i=0}^{b-1} \%K_{t-i}

With the default settings, the first %D value appears on candle 31.

How to read it

The main line is %K: red from 80 up, green at 20 and below, gray in between. %D is the orange companion line. Reference lines sit at 20, 50 and 80.

  • Extremes are common: The Stoch RSI often reaches 0 and 100. That only means the RSI is at the low or high of its last mm values, not that the RSI itself is oversold or overbought. An RSI of 55 can produce a Stoch RSI of 0.
  • Crossovers: If %K crosses the %D line upward from the lower zone, short-term momentum turns up; if it crosses downward from the upper zone, it turns down.
  • Timing in a trend: It works best as fine-tuning within a trend you determine some other way, for example for pullbacks in an uptrend that turn in the lower zone.

Settings

SettingDefaultEffect
RSI length14Length rr of the RSI from stage 1 (2–50).
Stochastic length14Window mm for the highest and lowest RSI (2–50).
%K smoothing3SMA length aa over the raw value (1–50).
%D smoothing3SMA length bb over %K (1–50).

Limitations

  • As an oscillator of an oscillator, it is very sensitive and produces many signals. In quiet phases it jumps across the whole scale on even small RSI moves.
  • On its own it says little about the direction of the trend.

Related indicators