Technical analysisModule 3, lesson 18 of 32
The stochastic oscillator
How the stochastic oscillator shows where the close sits in a recent range, how %K and %D are calculated, and how it behaves in trends and ranges.
In this lesson
- Calculate %K from the close and the recent high-low range.
- Explain the %D line and the conventional 80 and 20 levels.
- Explain how the oscillator behaves in trending and sideways markets.
- Compare the stochastic oscillator with RSI.
Builds on
- The relative strength index (RSI)The stochastic oscillator is another momentum oscillator, compared with RSI in this lesson.
On this page
In simple terms
The stochastic oscillator, developed by George Lane, asks a simple question: where did today's close sit within the recent trading range? If a share closes near the top of its range for the last 14 days, the oscillator is near 100; near the bottom, near 0.
The idea is that in rising markets, closes tend to be near the top of recent ranges, and in falling markets near the bottom. Like RSI, it is a momentum oscillator.
Calculating it
%K = (close − lowest low of N periods) ÷ (highest high of N periods − lowest low of N periods) × 100 %D = 3-period simple moving average of %K
N is usually 14. Many charting tools show a slow stochastic, which smooths %K first and then calculates %D from the smoothed values; settings differ between tools.
Worked example: A made-up share's %K
Over the last 14 sessions, Godavari Foods' highest high was ₹260 and its lowest low ₹220.
| Today's close ₹250: (250 − 220) ÷ (260 − 220) × 100 | %K = 75 |
|---|---|
| Yesterday's close ₹244: (244 − 220) ÷ 40 × 100 | %K = 60 |
| Two days ago, close ₹238: (238 − 220) ÷ 40 × 100 | %K = 45 |
| %D, the average of the last three %K values | 60 |
%K above %D shows the close has recently moved up within the range.
(For simplicity the example uses the same 14-day high and low each day; in practice the window moves each day.)
Overbought, oversold and crossovers
- Readings above 80 are conventionally called overbought; below 20, oversold.
- A crossover of %K above %D is often called a buy signal; below, a sell signal.
As with RSI, "overbought" describes a strong recent close, not a coming fall. In a strong uptrend, the price keeps closing near the top of its rising range, so the oscillator can stay above 80 for weeks. And because %K and %D cross very frequently, crossover signals are numerous and many are false.
Trends and ranges
The stochastic oscillator tends to behave differently in two kinds of market:
- In a trading range, closes swing between the top and bottom of a fairly stable range, so the oscillator swings between high and low readings, and extremes sometimes coincide with turns.
- In a trend, the range itself moves, closes stay near one end, and the oscillator stays at an extreme. Trading its signals against the trend produces repeated losses.
So a stochastic signal is only as useful as your judgement of whether the market is ranging or trending, which the market structure lesson discusses, and that judgement is often clear only in hindsight.
Stochastic compared with RSI
| Stochastic oscillator | RSI | |
|---|---|---|
| Measures | Where the close sits in the recent range | Size of recent gains compared with losses |
| Uses | High, low and close | Closes only |
| Typical behaviour | Faster, swings more | Smoother |
| Conventional extremes | 80 and 20 | 70 and 30 |
They often move together because both respond to recent strength. Using both does not double the evidence; it mostly repeats it.
Why it matters
The stochastic oscillator is common in trading apps, often presented with "buy when %K crosses above %D below 20". Understanding the calculation shows it is a simple description of where the close sits in a recent range, and why its frequent signals are unreliable on their own, especially in trends.
Limitations
Results depend heavily on the period and smoothing settings, which vary between tools. The oscillator is very sensitive in thinly traded shares, where single trades set the range. It lags turning points and gives many false crossovers.
Common mistakes
- Trading every crossover.
- Fighting trends with overbought or oversold readings.
- Treating stochastic and RSI agreement as independent confirmation.
- Comparing readings across tools with different settings.
Try it yourself
- Find the highest high and lowest low of any share over the last 14 sessions.
- Calculate %K for the last three closes and %D as their average.
- Compare your figures with a charting tool's stochastic and note any difference in settings.
- Count how many %K and %D crossovers happened in the last three months.
Key takeaways
- The stochastic oscillator shows where the latest close sits within the high-low range of the last N periods, usually 14, on a scale of 0 to 100.
- %K = (close − lowest low) ÷ (highest high − lowest low) × 100. %D is a short moving average of %K, usually 3 periods.
- Readings above 80 are conventionally called overbought and below 20 oversold. In strong trends, the oscillator can stay at these extremes for long periods.
- Crossovers of %K and %D happen very often and give many false signals, especially in trending markets.
- The oscillator behaves differently in trends and ranges, and settings and smoothing vary between charting tools.
Check your understanding
Finished reading?
Your progress is saved only in this browser.
Terms used in this lesson
- Stochastic oscillator
- A momentum oscillator showing where the latest close sits within the high-low range of the last N periods, on a scale of 0 to 100.
- Momentum oscillator
- An indicator that describes the speed or strength of recent price changes, usually swinging between fixed limits.
- Trading range
- A period in which prices move sideways between roughly stable highs and lows, without a clear trend.
Spotted a mistake or something unclear? Report it by email. Here is how corrections work.
This lesson is general education, not investment advice. Examples use made-up or clearly dated figures to explain ideas; they are not recommendations. Read the disclaimer.