2.62 A Statistically Sound Stochastic and Stochastic RSI

The raw stochastic lurches every time an old high or low drops out of its window, noise from a denominator that keeps redefining itself. Smooth it once or twice, center at 50, and the same trick fixes the StochRSI.

2.62 A Statistically Sound Stochastic and Stochastic RSI

The raw stochastic oscillator has a defect almost nobody who uses it has looked at, and it is not in the formula. The formula is fine. The problem is the denominator quietly jumps every time the lookback window rolls forward, and that jump injects noise that has nothing to do with where the close actually sits. The old article "How to Build Stationary Indicators from Non-Stationary Prices" argued that most indicator failures are a moving reference frame masquerading as signal. The stochastic is a textbook case, and the repair is two cheap smoothing passes.

What the stochastic actually measures

George Lane's idea is simple and worth keeping: look back a fixed number of bars including the current one, find the highest high and lowest low in that window, and report where the current close sits inside that range.

$$ \text{Raw Stochastic} = 100 \cdot \frac{\text{close} - \text{low}_n}{\text{high}_n - \text{low}_n} $$

The terms low and high are the lowest and highest prices over the n-bar window, so a close at the bottom of the range reads 0, a close at the top reads 100, and everything else lands in between by position. As a description of "where are we in the recent range" it is honest and bounded, which is more than raw price offers.

The rolling-range jump is the bug

Watch the denominator as the window advances one bar. You drop the oldest bar and add a new one. If the bar that fell off the back happened to be the window's high or low, the entire range snaps to a new value in a single step, and the raw stochastic lurches even when the current close barely moved. The oscillator is reacting to a bookkeeping event, the expiry of an old extreme, not to anything price did on this bar.

That is the non-stationarity the old stationary-indicators article warned about, sitting inside an indicator most people trust as-is. The reference frame, the high-low range, shifts discontinuously under the measurement, so any genuine information about the close's position gets drowned by the noise of a denominator that keeps redefining itself. Read the raw stochastic on a fast lookback and you see it: a jagged line slamming between extremes, far more violent than the underlying price warrants.

Smooth once, smooth twice, center at fifty

The repair is to smooth the raw output with an EMA-style pass, and if it is still too jumpy, smooth the smoothed version again.

$$ S_t = 0.66667\,S_{t-1} + 0.33333\,X_t $$

The term X is the raw stochastic on the current bar, S is the smoothed value, and the two coefficients are a fixed exponential blend, roughly a three-bar effective average. One pass absorbs most of the range-expiry jumps because a single discontinuous step in the input becomes a gentle ramp in the output. A second pass, applied to the first pass's output, kills what survives, at the cost of a little more lag. As with every smoother, you are buying steadiness with delay, so stop at two passes unless you have a reason to pay more. For a predictive model, subtract 50 so the indicator centers at zero, the same recentering the RSI wanted, because a feature that lives on 0 to 100 with a midpoint of 50 hands a linear model a baseline it has to learn instead of one you can give it for free.

Stochastic RSI: stack one bounded oscillator on another

The stochastic RSI is the hybrid you get by running the stochastic formula not on price but on the RSI series. Compute the RSI, then treat the RSI values as the input to the stochastic: find the highest and lowest RSI over the lookback and locate the current RSI inside that band.

$$ \text{StochRSI}_t = 100 \cdot \frac{\text{RSI}_t - \min_n(\text{RSI})}{\max_n(\text{RSI}) - \min_n(\text{RSI})} $$

The terms are the same as the price stochastic with RSI swapped in for price. The payoff is responsiveness: RSI already compresses price into a bounded range, and asking where today's RSI sits within its own recent range amplifies the moments when RSI itself is stretching to a local extreme, so the StochRSI reacts faster to changing conditions than either parent alone. It inherits the same disease, though. The RSI's rolling min and max jump on window expiry exactly like price's do, so the raw StochRSI gyrates just as wildly and needs the same one-or-two-pass smoothing before it is fit to use.

Use it knowing what you smoothed away

The smoothed stochastic is a cleaner cycle-position reader than the raw version, and it is still a bounded oscillator, not a forecast. Each smoothing pass adds lag, so the two-pass version will confirm a turn later than the raw output that whipsawed you, which is the trade you chose when you stopped the noise. The lookback sets the cycle length the oscillator is tuned to, and a length that fits one regime will mismatch another, so it is a parameter to set deliberately and re-examine, not a constant. The StochRSI buys faster response by compounding two bounded transforms, and it pays for that with a sharper temper, so the smoothing is not optional there, it is the price of admission. Bounded and centered does not mean predictive: a clean stochastic still has to earn an edge on your instrument before you trust it, which is the empirical test no amount of smoothing can pass on its behalf.

KEY POINTS

  • The stochastic reports where the close sits inside the recent high-low range, bounded 0 to 100. The formula is sound; the denominator is the problem.
  • As the window rolls, dropping an old high or low snaps the range to a new value in one step, so the raw stochastic lurches on a bookkeeping event rather than on price. This is the non-stationary reference frame from the old stationary-indicators article.
  • Fix it by smoothing the raw output once with an EMA-style blend, twice if it is still jumpy; a discontinuous input step becomes a gentle ramp. Subtract 50 to center it for modeling.
  • The stochastic RSI runs the stochastic formula on the RSI series instead of price, giving faster response because it flags when RSI itself stretches to a local extreme. It inherits the same range-expiry jumpiness and needs the same smoothing.
  • Each smoothing pass costs lag, the lookback is a deliberate parameter tied to cycle length, and a clean bounded oscillator still has to prove a real edge before you trade it.

References