Debated1 min read
◆ The PatternWhere the close sits inside its recent range: near the top in strength, near the bottom in weakness
The Stochastic Oscillator — developed by George Lane in the 1950s.
%K = (Close − Lowest Low) / (Highest High − Lowest Low) × 100
%D = SMA(3) of %K
%D = SMA(3) of %K
Scale: 0–100. Default lookback: 14 periods.
Signals:
• Above 80 = overbought, below 20 = oversold
• %K crossing above %D = buy
• %K crossing below %D = sell
The slow stochastic uses smoothed %K for fewer false signals.
• Above 80 = overbought, below 20 = oversold
• %K crossing above %D = buy
• %K crossing below %D = sell
The slow stochastic uses smoothed %K for fewer false signals.
Worked example
Day 15, five-day window: lowest low 98 (day 13), highest high 105, close 104. %K = 100 × (104 − 98) / (105 − 98) = 85.7 — after the rebound the close sits near the top of its range. %D, the three-day average of %K, is only 46.2, because days 13 and 14 were low (10.0 and 42.9).
The example data: 15 days, used in every indicator here
| Day | High | Low | Close | Volume |
|---|---|---|---|---|
| 1 | 101 | 99 | 100 | 50,000 |
| 2 | 103 | 100 | 102 | 62,000 |
| 3 | 103 | 100 | 101 | 48,000 |
| 4 | 105 | 101 | 104 | 70,000 |
| 5 | 108 | 104 | 107 | 85,000 |
| 6 | 108 | 105 | 106 | 60,000 |
| 7 | 110 | 106 | 109 | 90,000 |
| 8 | 110 | 107 | 108 | 72,000 |
| 9 | 108 | 104 | 105 | 80,000 |
| 10 | 105 | 102 | 103 | 66,000 |
| 11 | 105 | 102 | 104 | 55,000 |
| 12 | 104 | 101 | 102 | 75,000 |
| 13 | 102 | 98 | 99 | 95,000 |
| 14 | 102 | 99 | 101 | 64,000 |
| 15 | 105 | 101 | 104 | 71,000 |
Where it misleads
- In a strong trend %K stays near 100 (or 0) for long stretches, so overbought and oversold readings fight the trend.
- A narrow range makes it jumpy: when the window’s high and low are close, a small move swings %K across the whole scale.
- %K and %D cross often; without a trend filter most crossings are noise.
In code
ll = df['low'].rolling(5).min() hh = df['high'].rolling(5).max() df['k'] = 100 * (df['close'] - ll) / (hh - ll) df['d'] = df['k'].rolling(3).mean()
Assumes import numpy as np, import pandas as pd, and a DataFrame df with columns high, low, close and volume — the 15 days above.
Sources
- G. C. Lane, “Lane’s Stochastics”, Technical Analysis of Stocks & Commodities 2(3), 1984
- Technical Analysis of the Financial Markets, J. J. Murphy, New York Institute of Finance, 1999
Last reviewed October 2026 · How this site checks its content · Report a mistake
Pattern bridge: Where price sits in its recent range is a percentile rank. The smoothed %D line is an EMA applied to the oscillator — momentum of momentum.
Linked from 1