GlossaryStochastic Oscillator

Stochastic Oscillator

The Stochastic shows where the close sits within the range of the last candles: 100 means at the highest high, 0 at the lowest low. If the price keeps closing near the upper edge of its range, short-term momentum is pointing up; near the lower edge, down.

Calculation

CtC_t is the close, HtH_t the high, LtL_t the low of a candle. nn is the %K length, aa the %K smoothing, bb the %D smoothing.

1. Range of the last nn candles, including the current one:

HHt=max⁡0≤i<nHt−i,LLt=min⁡0≤i<nLt−i\mathrm{HH}_t = \max_{0 \le i < n} H_{t-i}, \qquad \mathrm{LL}_t = \min_{0 \le i < n} L_{t-i}

2. Raw value: the position of the close within this range, in percent:

%Ktraw=100⋅Ct−LLtHHt−LLt\%K^{\text{raw}}_t = 100 \cdot \frac{C_t - \mathrm{LL}_t}{\mathrm{HH}_t - \mathrm{LL}_t}

3. %K and %D: two simple moving averages in a row:

%Kt=1a∑i=0a−1%Kt−iraw,%Dt=1b∑i=0b−1%Kt−i\%K_t = \frac{1}{a}\sum_{i=0}^{a-1} \%K^{\text{raw}}_{t-i}, \qquad \%D_t = \frac{1}{b}\sum_{i=0}^{b-1} \%K_{t-i}

With the default values 14, 3, 3, this is the “slow” Stochastic. If you set the %K smoothing to 1, %K is the raw value, the “fast” Stochastic.

If a window has no range at all (all highs equal to all lows, for example with a very thinly traded symbol on short intervals), there is no value. The line is interrupted there instead of showing a made-up 50. The first %D value appears on candle n+a+b−2n + a + b - 2, which is candle 18 with the default settings.

How to read it

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

  • Overbought and oversold: Above 80, the price closes near the high of its range, below 20 near the low. That describes a state, not a reversal signal.
  • Crossovers: If %K crosses the %D line upward, short-term momentum turns up; downward, it turns down. Crossovers that happen in an extreme zone and lead out of it carry the most weight.
  • Divergences: A new price low with a higher Stochastic low points to fading selling pressure, mirrored at the high.
  • In a trend: In a strong uptrend, the Stochastic can stay above 80 for a long time. Sell signals against the trend then often fail. Many therefore only use it in the direction of the trend, such as buy signals from the lower zone in an uptrend.

Settings

SettingDefaultEffect
%K length14Number of candles nn for the high and low of the range (1–100).
%K smoothing3SMA length aa over the raw value (1–50). 1 means unsmoothed.
%D smoothing3SMA length bb over %K (1–50).

Limitations

  • The Stochastic is fast and produces many signals, especially on short intervals. Without a trend filter, many of them are false signals.
  • It only measures the position in the range, not the size of the range: a narrow range after a calm phase lets even small moves jump from 0 to 100.

Related indicators