Why usFeaturesTemplatesBlogGlossary

Stochastic Oscillator

An oscillator that reports where the current close sits within the high-low range of the recent lookback window, scaled from 0 to 100.

George Lane popularised the stochastic oscillator in the 1950s around a single observation: as a rally loses steam, closes tend to drift toward the low end of each session’s range rather than the high end. The indicator turns that into a number. The call is @STOCH(high, low, close).

How it is computed

%K = 100 * (close - lowest_low_N) / (highest_high_N - lowest_low_N)

%D = SMA(%K, 3)

A %K of 100 means the close is exactly at the top of the N-bar range. A %K of 0 means it closed at the bottom. The %D line is a smoothed version, and the pair produce two series from one call, so a rule names which one it wants.

The signature takes the three price fields and no window argument, so the lookback is the function’s own default rather than something you sweep. You tune the rule around the output, not the lookback inside it:

@STOCH(high, low, close) < 20

Note the name is a historical accident. There is nothing stochastic about the calculation, which is fully deterministic.

Typical thresholds

ReadingDescriptionWhat it actually says
Above 80overboughtclose is in the top fifth of the recent range
Below 20oversoldclose is in the bottom fifth of the recent range
50neutralclose is mid-range
%K crossing %Dsignalthe raw line crossed its own 3-period average

The 20 and 80 lines are Lane’s convention, drawn where they were easy to read on paper. They carry no statistical meaning and were never derived from Indian equities.

How to read the output

Read the reading literally and the indicator stops being mysterious. A stochastic of 12 on TCS says today’s close was near the bottom of the last N sessions’ range. That is a fact about the recent range, restated as a percentage. It contains no information about value, earnings, or what happens next.

Risks and caveats

The denominator is the whole problem. When a stock trades in a tight band, highest_high - lowest_low is small, and a trivial price move swings the oscillator from 15 to 85. Readings become extremely noisy exactly when the underlying move is meaningless.

The opposite failure appears in a trend. In a sustained decline the close keeps landing near the bottom of the range, so the oscillator pins below 20 and stays there while the stock keeps falling. Buying every oversold print in a downtrend is the standard way this indicator loses money.

Because the calculation depends on the session high and low, it is sensitive to illiquid price prints. On a Nifty 500 small-cap where the daily high was set by one trade, the range that anchors the whole formula is not a reliable measurement.

Back to Glossary