Skip to content

What the stochastic oscillator is

Reading the chart

What the stochastic oscillator is

Take the highest high and the lowest low of the last fourteen bars, and mark where the most recent close sits between them. Right at the top of that band is one hundred. Right at the bottom is zero. Halfway is fifty. That single measurement, repeated bar after bar and drawn in a pane beneath the chart, is the stochastic oscillator, and the word stochastic in its name describes nothing about the arithmetic at all.

7 min read, Reviewed

What you will be able to do

  • State the stochastic calculation in terms of range position
  • Distinguish the fast and slow variants
  • Explain what the two plotted lines represent
  • Explain why the indicator saturates in a strong directional move

The question the calculation asks 

Most of the indicators treated so far in this module read closes and do something to the level or the change. This one reads three numbers and does something to their geometry. It takes the highest high reached over a stated number of completed bars, the lowest low reached over the same bars, and the latest close, and it reports the position of that close between the two extremes as a percentage of the distance between them.

The distance from the low to the close is divided by the distance from the low to the high, and the result is multiplied by one hundred. Nothing else enters the calculation. Not the opens, not the order in which the bars arrived, not how far the range travelled in price terms, not how long the instrument spent anywhere inside it. The output is a statement about one bar's close relative to a band, and the band is redrawn from scratch on every new bar.

Key term

Range
Range means two things on a chart: the distance between the high and the low of a period, and the condition in which price keeps turning back inside a band instead of travelling in one direction.
Worked example. Illustrative figures, not YAL prices or terms.

Where a close sits inside a five bar band

Highest high over the window
110
Lowest low over the window
100
Latest close
107
Height of the band
110 - 100 = 10
Distance from the low to the close
107 - 100 = 7
Range position
7 ÷ 10 × 100 = 70
Same band, a close at the high
10 ÷ 10 × 100 = 100
Same band, a close at the low
0 ÷ 10 × 100 = 0

The prices are round and unit free and are not a quotation for any instrument. A window of five bars keeps the arithmetic legible; the conventional window is longer, and the mechanism is identical at any length. The reading describes the bars that produced it and no cost forms part of it.

Two consequences follow immediately from that division. The reading cannot leave the range from zero to one hundred, because the close of a bar inside the window cannot be higher than the highest high of the window or lower than its lowest low. And the reading is dimensionless: a band ten points tall and a band a thousand points tall both produce a number on the same scale, so the height of the band is discarded by the arithmetic that produces the percentage.

Key term

Stochastic oscillator
The stochastic oscillator plots where the latest close sits inside the high to low range of a chosen lookback, on a scale from zero to one hundred, with a smoothed signal line drawn across it.

The window is built from highs and lows 

The band is drawn from the extremes of the bars, not from their closes, and that choice separates this calculation from the averages and the change measures already covered. A wick that reached far beyond every close in the window still sets the edge of the band, and it goes on setting it for as many bars as the lookback holds it. One unusually wide bar therefore changes every reading that follows it, until it falls out of the window and the band snaps back to whatever the remaining bars describe.

That is worth holding onto, because it is a source of movement in the plotted line that has nothing to do with the latest bar. The reading can drop sharply on a bar whose own close barely moved, purely because an old extreme aged out of the window and the denominator changed underneath it. Traditions that describe the line's slope as momentum are describing something the arithmetic does not separate: the numerator and the denominator both move, and the plotted value does not record which of them did.

Why there are two lines 

The raw range position, computed fresh on every bar, is conventionally called the fast line. Plotted on its own it is jagged, because a single bar's close landing near either edge of the band moves it the full width of the scale. The second line is that first line smoothed: an average of the last three of its values, computed exactly as the moving average lesson described, and conventionally called the slow line or the signal line.

Key term

Oscillator
An oscillator is an indicator that moves within fixed limits or around a centre line, describing how fast and how far price has moved recently rather than which way the trend runs.
Worked example. Illustrative figures, not YAL prices or terms.

The second line is the first line averaged

Range position, bars one to five
70, 90, 80, 40, 30
Three period average at bar three
(70 + 90 + 80) ÷ 3 = 80
Three period average at bar four
(90 + 80 + 40) ÷ 3 = 70
Three period average at bar five
(80 + 40 + 30) ÷ 3 = 50
Bar at which the raw line turns down
three
Bar at which the averaged line turns down
four

The readings are illustrative and describe no instrument. The averaged line turns one bar later than the line it is computed from, which is a property of averaging rather than of this indicator, and a longer averaging window separates the two turns further. No position is implied by this calculation and no cost forms part of it.

The fast and slow variants are named for which pair of lines is plotted, and the difference is one averaging step. In the fast variant the raw range position is the main line and its three period average is the second. In the slow variant the arithmetic moves along by one: the three period average becomes the main line, and an average of that becomes the second. The slow variant is therefore not a different measurement. It is the same measurement with one more smoothing applied to both lines, which is why its swings are shallower and why each of its turns arrives later than the equivalent turn in the fast variant.

Key term

Moving average
A moving average is the average of a fixed number of recent prices, recalculated on every new bar, which smooths a price series by lagging it.

Charting packages differ in what they label. Some plot the fast variant and call it stochastic, some plot the slow variant under the same name, and some expose the lookback and both averaging lengths as settings without saying which combination corresponds to which traditional name. Two charts of the same instrument over the same bars can therefore show visibly different stochastic lines while both are correctly implemented, and the settings panel is the only place that resolves which calculation is on screen.

Why the reading pins to an edge in a strong move 

The bounded scale has a consequence that governs how the indicator behaves in exactly the conditions it is most often consulted about. When a series moves persistently in one direction, each new bar sets a new extreme of the window and closes near that extreme. The numerator and the denominator then grow together, the ratio stays close to one, and the reading sits near the top of the scale bar after bar without an upper limit on how long it can stay there.

Key term

Overbought
Overbought describes a market that has risen far and fast enough for a bounded oscillator to sit above a conventional threshold, which is a statement about speed rather than about value.
Worked example. Illustrative figures, not YAL prices or terms.

A three bar window through a persistent move, both directions

Highs, bars one to six
102, 104, 106, 108, 110, 112
Lows, bars one to six
98, 100, 102, 104, 106, 108
Closes, each bar closing at its own high
102, 104, 106, 108, 110, 112
Range position at bar three
(106 - 98) ÷ (106 - 98) × 100 = 100
Range position at bars four, five and six
100 at every bar
The mirror case, a series falling by the same amounts
0 at every bar
Reading if the move continues for a further twenty bars
unchanged, at the same edge

The prices are round, unit free and describe no instrument. Closes are placed at the extreme of each bar to isolate the mechanism; closes near the extreme rather than at it produce a reading near the edge rather than exactly on it, and the behaviour is the same. The rising and falling cases are the identical calculation with the direction reversed. No position is implied and no cost forms part of this arithmetic.

A reading pinned at an edge is not a malfunction, and it is not a measurement of intensity either. It reports, correctly, that recent closes have been landing at the recent extreme. It cannot report how far the move has travelled, because the height of the band was divided out, and it cannot report how long the condition has persisted, because each bar's reading is computed independently of the last. A series that has held the top of its range for three bars and one that has held it for thirty produce the same number.

The conventional readings, and what they assert 

Two conventions are attached to the scale in most trading literature. The first draws horizontal bands at eighty and twenty, and describes readings above and below them as overbought and oversold. Those words are labels for a range position and nothing more: a reading above the upper band states that recent closes sat in the top fifth of the recent band, which the previous section showed can persist for as long as a directional move persists. The same literature that names the bands also records that they hold for extended stretches, which is why practitioners who use them at all conventionally describe them as a description of the window rather than as a statement about what follows.

The second convention concerns the two lines crossing. Because one line is an average of the other, a crossing is an arithmetic event with a fixed meaning: the latest range position has moved to the other side of the average of the last few range positions. Traditions that treat crossings as meaningful disagree about whether a crossing inside the middle of the scale carries the same content as one near an edge, and about whether the frequency of crossings on a short lookback leaves any of them informative. There is no agreed test that settles either question on a given chart.

Every value the stochastic oscillator plots is computed from bars that have already completed. A reading at either edge of the scale describes where recent closes sat inside a recent band and carries no information about prices that have not yet printed. Nothing in this lesson describes a level at which anything is done.

The conditions under which the reading is useless 

Four conditions make the number technically correct and descriptively empty, and all four follow from the division rather than from any implementation detail.

  • A persistent directional move saturates the scale, as the worked example above shows. The reading holds at an edge, stops distinguishing one bar from the next, and reports the same value whether the move has just begun or has run for weeks.
  • A very narrow band makes the denominator small, so a trivial move in the numerator swings the reading across the whole scale. On a quiet session the line can travel from one edge to the other on price movement too small to be visible on the chart above it.
  • A window in which the highest high equals the lowest low makes the denominator zero and the ratio undefined. Charting packages resolve this differently, some carrying the previous value forward and some plotting the midpoint, so two implementations can print different numbers for the same flat window.
  • A gap redraws the band in one step. When a session opens away from the previous close, the new extreme enters the window immediately, and the reading changes by an amount that reflects the gap rather than anything the current bar did.

The common thread is that the indicator discards the two things a reader of the chart above it can see directly: how large the band is, and how the instrument moved through it. A percentage of a range that is never stated is a compressed description, and the compression is the reason the calculation is quick to read and the reason it cannot answer questions about size or duration.

Where practitioners disagree 

The first disagreement is about the lookback and the averaging lengths. A short lookback produces a line that reaches both edges frequently, a long one produces a line that reaches them rarely and later, and no setting removes both of those properties because they are one quantity read from opposite ends. Named default combinations circulate widely and are conventionally repeated, but they originate as choices made on particular instruments and particular bar intervals decades ago, and no procedure in common use establishes that a default transfers to a different instrument or a different timeframe.

The second is whether this indicator adds anything beside the bounded measures already covered in this module. One position holds that a range position and a normalised measure of recent change read the same bars through different arithmetic, so their agreement is one history counted twice, which is the redundancy the leading and lagging lesson set out. Another holds that a measure built from highs and lows behaves differently around the edges of a range from a measure built from closes, and that the difference is real even where the two lines usually agree. Both descriptions of the arithmetic are accurate, which is why the argument recurs rather than resolving, and neither side has produced a test of the question that the other accepts.

In summary 

  • The stochastic oscillator reports where the latest close sits between the highest high and the lowest low of a stated number of completed bars, as a percentage of the distance between them. That is the whole calculation.
  • There are two lines because the second is the first one smoothed. The fast and slow variants differ by a single averaging step, so the slow variant is the same measurement with shallower swings and later turns, not a different one.
  • The scale is bounded by construction, so a persistent directional move pins the reading at an edge for as long as it lasts. A pinned reading reports that closes are landing at the recent extreme and reports nothing about how far or how long the move has run.
  • The height of the band is divided out and the path through it is discarded. Traditions attach conventional bands and crossings to the scale, disagree about the settings and about whether the measure adds anything to the other bounded measures, and no agreed test settles either question.

Get started

Open your account in four steps.

A clear path from sign-up to your first trade, in four steps.

No depositNo documents

  1. 01/ 04step 1 of 4

    Register

    A few details to get started.

    No deposit to open

  2. 02/ 04step 2 of 4

    Verify

    Confirm your identity, securely.

    ID and proof of address

  3. 03/ 04step 3 of 4

    Fund

    Add money by bank transfer or card.

    From $0

  4. 04/ 04step 4 of 4

    Trade

    Go live on the platform you already know.

    MetaTrader 5

Cookies on this site

Some cookies are needed to make the site work. With your permission we also use analytics cookies to see which pages are read, so we can improve them. You can change your choice at any time.