Library · Indicators

Stochastic Oscillator

The Stochastic Oscillator shows where the latest close sits within the high-low range of recent candles, on a scale from 0 (at the low) to 100 (at the high).

  • Intermediate
  • 5 min read
  • Updated

Why it matters

The Stochastic Oscillator asks a simple question that no moving average answers: within the range price has covered lately, did the latest candle close near the top, near the bottom or in the middle?

It looks a lot like RSI, and the two are often confused. They share a 0-100 scale and the words “overbought” and “oversold”, but they measure different things. Knowing the difference prevents the common habit of using one to “confirm” the other.

What it looks like

Price (hypothetical)8020%K%D (signal)
Two lines in a panel below price: %K and the slower %D. In a sideways market they swing between the upper and lower zones as price moves across its range. Hypothetical data for illustration.

The indicator has two lines:

  • %K: the main line. It shows where the close sits in the recent range.
  • %D: a 3-period simple moving average of %K. It is sometimes called the signal line, although it is only a smoothed copy.

Reference lines are usually drawn at 80 and 20.

How it is calculated

%K = 100 x (close - lowest low of N) / (highest high of N - lowest low of N)N is the lookback period, 14 by default. %D is a 3-period SMA of %K.

Take the highest high and the lowest low of the last 14 candles. That is the recent range. %K is the distance from the low to the latest close, expressed as a percentage of that range.

Same 14-period range (low 100, high 120), three different closes
Close at 11995

100 x (119 - 100) / 20

Close at 11575

100 x (115 - 100) / 20

Close at 1015

100 x (101 - 100) / 20

Hypothetical values of %K. The reading is simply how far up the range the close sits, as a percentage.

In plain words

Imagine a thermometer whose bottom mark is the coldest moment of the last two weeks and whose top mark is the hottest. Today’s reading shows where today sits between those two extremes. A reading of 95 means “close to the warmest it has been lately”. It does not mean it is hot, and it does not mean tomorrow is cooler.

Fast, slow and the three numbers

The raw %K from the formula is jumpy. Most platforms therefore show a smoothed version, described by three numbers such as 14, 3, 3:

Number What it sets
14 The lookback period for the high-low range
3 Smoothing applied to %K (a 3-period average of the raw value)
3 The period of %D, the average of the smoothed %K

The unsmoothed version is called the fast stochastic. The smoothed version is the slow stochastic, and it is the one shown in the figures on this page. Names and defaults differ slightly between platforms, so it is worth checking the indicator settings.

A shorter lookback makes the range narrower and the lines swing from one extreme to the other more often. A longer lookback or more smoothing calms the lines and delays them. Tuning these numbers until old charts look ideal is overfitting.

How to read it

Reading the 0-100 scale
  1. Above 8080-100The close is in the top fifth of the recent range. Conventionally called "overbought".
  2. Around 5050The close is in the middle of the recent range.
  3. Below 200-20The close is in the bottom fifth of the recent range. Conventionally called "oversold".
80 and 20 are conventions. The reading describes position inside a range, not value.
  • High readings mean closes are near the top of the recent range. Low readings mean closes are near the bottom.
  • %K crossing %D means the latest reading has moved above or below its own short average. It shows a small change in pace.

All of these describe candles that have already closed. A cross or a move out of a zone is an event in past data. It is not a signal.

Going deeper

Price (hypothetical)8020%K%D (signal)
In a steady trend, closes keep landing near the top of the recent range, so the lines can stay in the upper zone for long stretches. Hypothetical data for illustration.

In a strong uptrend, each candle tends to close near the top of the last 14 candles. The Stochastic then sits above 80 for long stretches. That is the indicator working correctly: it is reporting that closes are near the highs. The same applies below 20 in a strong downtrend.

The classic 80 and 20 reading is most relevant in a range, where price really does travel back and forth between two boundaries.

How it differs from RSI

RSI compares the size of recent gains with recent losses. The Stochastic compares the close with the recent high-low range. The Stochastic usually moves faster and reaches its extremes more often. Both are built from the same recent prices, so they frequently agree, and their agreement is not independent evidence.

One range, two readingsHypothetical illustration

Over the last 14 candles a hypothetical market has traded between a low of 100 and a high of 120. The latest close is 115.

%K = 100 x (115 - 100) / (120 - 100) = 100 x 15 / 20 = 75.

On the next candle price breaks higher and closes at 126, with a high of 127. The 14-period high is now 127. If the lowest low is still 100:

%K = 100 x (126 - 100) / (127 - 100) = 100 x 26 / 27 = 96.3.

The reading jumped into the “overbought” zone at the moment price broke out. Whether that marks an exhausted move or the start of a trend is something the number alone cannot say.

How practitioners use it

Traders who use the Stochastic generally pair it with context: the state of market structure, nearby support and resistance, and volume. Some also watch for divergence between price and the oscillator. In each case it adds detail to a view. It does not create one.

What it does NOT mean

  • Above 80 does not mean “sell”. It means the close is near the top of the recent range, which is what every strong advance looks like.
  • Below 20 does not mean “buy”. A falling market closes near its lows candle after candle.
  • “Overbought” does not mean overpriced. The indicator knows nothing about value.
  • A %K and %D cross is not a turning point. The lines cross many times inside any zone.

Common mistakes

  1. Fading every extreme. Treating 80 and 20 as automatic reversal points fights strong trends.
  2. Using it to confirm RSI. Two oscillators built on the same recent prices repeat one opinion.
  3. Ignoring the lookback. A reading of 90 on a 5-period setting and on a 21-period setting describe very different ranges.
  4. Over-smoothing or over-tuning. Settings fitted to past charts rarely hold up on new data.

Risks and limitations

  • The Stochastic is calculated from past highs, lows and closes, so it lags.
  • It is very sensitive and produces many short-lived readings in choppy markets.
  • A single unusual high or low inside the lookback distorts the range until it drops out.
  • It contains no information about volume, volatility or the larger trend.

Key takeaway

The Stochastic Oscillator shows where the close sits inside the recent high-low range. High and low readings describe position within that range. They do not say the range is about to hold.

Sources and further reading

  • Technical Analysis of the Financial Markets, John J. Murphy (1999). Chapter on oscillators, including the Stochastic Oscillator popularised by George Lane