Stochastic Oscillator (Mean reversion)
Lane's stochastic: buys when %K crosses above its %D signal line while still under the oversold 20 level, and holds until the oscillator reaches overbought 80.
How It Works
- Compute %K — where the close sits inside the 14-bar high-low range, from 0 at the bottom to 100 at the top — and %D, its 3-bar average.
- Buy when %K crosses above %D while still below 20: price is pinned near the bottom of its recent range but has just started turning up, which is Lane's oversold reversal.
- Sell when %K reaches 80, the top fifth of the range.
Worked example. Over 14 bars the range is 90 to 110. A close at 94 puts %K at 20, and as it ticks up through %D the strategy buys. The recovery carries price to 108, %K prints 90, and the position is closed in the overbought zone.
The Math Behind The Indicators
Everything runs on closing prices of the traded timeframe: P is a close, Pt today's close, and N counts bars — one bar is one candle of that timeframe, so 20 bars on a 1h chart is 20 hours.
- Stochastic Oscillator (%K, %D)
- Where the close sits inside the recent high-low range, as a percentage: 0 means it closed at the very bottom of the last N bars, 100 at the very top. Because it measures position within the range rather than the size of price changes, it reads the bar's high and low directly. %K is that raw reading, smoothed slightly; %D is a 3-bar average of %K used as its signal line.
- \[\%K = 100 \cdot \dfrac{P_t - \min(L_N)}{\max(H_N) - \min(L_N)}, \quad \%D = \mathrm{SMA}_3(\%K)\]
- Example: Over the last 14 bars the high was 110 and the low 90. A close at 95 gives %K = 100·(95 − 90)/(110 − 90) = 25 — near the bottom of the range. A close at 108 would give 90, close to the top.
Example Chart
Example Chart
Stochastic Oscillator (Mean reversion)
Real Data28/ 100Composite score
Metrics Per Trade
Metrics Per Trade
Real data · Stochastic Oscillator (Mean reversion)
Final Metrics
Final Metrics
Real data · Stochastic Oscillator (Mean reversion)
Scores
Scores
Real data · Stochastic Oscillator (Mean reversion)
Resampled Data28/ 100Composite score
Metrics Per Trade
Metrics Per Trade
Resampled data · Stochastic Oscillator (Mean reversion)
Final Metrics
Final Metrics
Resampled data · Stochastic Oscillator (Mean reversion)
Scores
Scores
Resampled data · Stochastic Oscillator (Mean reversion)