Metric · Price and risk
Stochastic Oscillator Formula: %K, %D and a Worked Example
The stochastic oscillator asks one thing: where did today's close land inside the recent high-low range? Near the top reads high, near the bottom reads low, on a 0 to 100 scale.
Formula
%K = (close − lowest low) ÷ (highest high − lowest low) × 100 over the last 14 periods; %D is a 3-period average of %K
Stochastic (14, 3, 3): A momentum indicator that places the latest close within the high-low range of a recent period, scaled from 0 at the range's low to 100 at its high.
Also shown as Stochastic oscillator, %K, %D, Slow stochastic, Fast stochastic, Full stochastic.
The stock’s 14-day range runs from $50 to $60. Today it closed at $57. That’s 70% of the way up the range, and 70 is today’s stochastic reading. Every other part of the indicator is smoothing laid on top of that one ratio.
%K, worked out
The raw line is called %K. Take the close, subtract the lowest low of the lookback, and divide by the full high-low range. Multiply by 100.
A close at the 14-day high gives 100. A close at the low gives 0. The reading can’t go outside those limits, because the close always sits inside the range that includes it.
%D is a three-period simple average of %K. It’s the slower line, and crossings between %K and %D are the indicator’s signals.
Fast, slow and full
Raw %K jumps around. One wide-range day changes the denominator, and the reading can lurch from the top of the scale to the middle even though the close barely moved, simply because the range it’s measured against got bigger. So most charts smooth it.
- Fast stochastic: raw %K and its three-period average as %D. Quick and noisy.
- Slow stochastic: the fast %D becomes the new %K, and a further three-period average becomes the new %D. Fewer signals, each a little later.
- Full stochastic: you choose all three numbers. Settings of 14, 3, 3 give the same result as the slow version.
If your chart says “stochastic” with no qualifier, check the settings box. Many platforms default to the slow version without saying so.
Reading 80 and 20
Above 80 is conventionally called overbought; below 20, oversold. Those labels mislead in a trend.
A stock in a strong uptrend closes near the top of its range day after day. The stochastic stays above 80 for weeks, and anyone who sold every time it crossed 80 would have stepped out of the whole move, one small exit at a time, while the price kept setting new highs right above them. In a downtrend the same thing happens near zero. The levels work best in a stock moving sideways, where the range holds and closes near its edges tend to turn back.
So read the trend first. A 52-week high with the stochastic pinned above 80 is strength, not a warning.
Crossovers and divergence
A buy signal in the textbook version is %K crossing above %D while both lines are below 20, and a sell signal is the reverse, %K crossing below %D while both are above 80. Mid-scale crossings happen constantly.
Divergence works as it does on other oscillators. Price makes a lower low; the stochastic makes a higher low. Selling pressure is easing, even though the price is still falling. It can persist for a while before anything changes.
Stochastic and RSI
Both run from 0 to 100 and both get labeled overbought and oversold. They’re built differently. RSI compares the average size of up days with the average size of down days. The stochastic only cares where the close sits in the range.
That makes the stochastic quicker. It reaches extremes more often and can swing across the whole scale in a few days, while RSI moves more slowly, spends more of its time in the middle of the range, and needs a longer run of one-sided days to reach its own extremes. Many traders use the stochastic for timing short-term entries and RSI for judging how stretched a move has become.
Time frame changes everything
Fourteen periods on a daily chart is about three weeks. On a 15-minute chart it’s half a morning. On a weekly chart it’s over three months. The same 80 reading means very different things across those, and choosing a chart time frame from your holding period matters more for this indicator than for slower ones, because it reacts so quickly to whatever range it’s given.
Where tools differ
- Default version. Fast, slow or full, often unlabeled.
- Smoothing type. Simple averages are standard; some platforms offer exponential.
- Price input. Most use high and low for the range. A few use closes only, which gives a narrower range and more extreme readings.
- Level lines. 80 and 20 are common; some charts draw 70 and 30.
Check all four before comparing readings across platforms. More indicator definitions are under metrics.
Related questions
What do the settings 14, 3, 3 mean?
On a full stochastic, 14 is the lookback for the high-low range, the first 3 smooths the raw %K into the slow %K, and the second 3 averages that into %D. A setting of 14, 3 without the third number usually means the fast or slow version, depending on the platform.
Is the stochastic oscillator better than RSI?
Neither is better; they measure different things. RSI compares the size of recent gains and losses. The stochastic compares the close with the recent range. The stochastic moves faster and swings to extremes more often, which suits short-term range trading and produces more false signals in trends.
What happens when the high and low are the same?
The range is zero and the formula would divide by zero. That only happens when a stock has not moved at all over the whole lookback. Platforms handle it differently, usually by holding the previous value or showing a gap.