Oversold %K/%D cross
A mean-reversion long that fires when momentum confirms a turn from oversold.
Stochastic Oscillator
A bounded 0–100 oscillator that measures where the close sits relative to the high-low range over a chosen lookback — paired with a smoothed signal line for crossover triggers.
Stochastic is a 0–100 momentum oscillator that measures where the close sits within the high-low range over the past N bars. The fast %K line and its smoothed %D signal line cross above 80 for overbought conditions and below 20 for oversold. Default settings: %K=14, %D=3.
Developed by George Lane in the 1950s, the Stochastic Oscillator compares the current close to the trading range of the past N bars (typically 14). The fast %K line ranges 0–100, and a smoothed %D line (default 3-period SMA of %K) acts as a trigger. Readings above 80 are conventionally "overbought," below 20 "oversold."
Stochastic shines in ranging markets where price oscillates between support and resistance — the %K/%D crossovers in oversold/overbought zones produce reliable mean-reversion signals. In strong trends it tends to lock in extremes for long stretches, so use a trend filter alongside it.
Entry ideas
A mean-reversion long that fires when momentum confirms a turn from oversold.
A trend-aligned long that buys momentum resets in confirmed uptrends.
A reversal-anticipation entry that spots fading downside momentum before price turns.
Exit ideas
A symmetrical exit that mirrors the oversold-cross entry.
An early exit that catches momentum exhaustion before the full %K/%D cross fires.
A proactive exit triggered when rising price stops producing rising momentum.
Utilities
A directional filter that keeps trades aligned with prevailing momentum.
A confirmation filter that requires both Stochastic lines to point the same way.
| Parameter | Default | When to adjust |
|---|---|---|
| %K period | 14 | Lane's original setting. Drop to 9 for faster signals on intraday; raise to 21 for less noise on daily charts. |
| %K smoothing | 1 (raw) or 3 (slow) | Raw %K = 'Fast Stochastic'. Smoothing %K with a 3-bar SMA = 'Slow Stochastic' — less noisy, more popular today. |
| %D smoothing | 3 | %D = 3-bar SMA of %K. The standard Stochastic signal line. Tighter (2) gives earlier signals; wider (5) is smoother. |
| Overbought threshold | 80 | Raise to 90 in strong uptrends to filter trend-continuation false sells. |
| Oversold threshold | 20 | Drop to 10 in strong downtrends. |
//@version=5
indicator("Stochastic Example", overlay=false)
lengthK = input.int(14, title="%K Length", minval=1)
smoothK = input.int(3, title="%K Smoothing", minval=1)
smoothD = input.int(3, title="%D Smoothing", minval=1)
k = ta.sma(ta.stoch(close, high, low, lengthK), smoothK)
d = ta.sma(k, smoothD)
plot(k, title="%K", color=color.blue, linewidth=2)
plot(d, title="%D", color=color.orange, linewidth=2)
hline(80, "Overbought", color=color.red, linestyle=hline.style_dashed)
hline(20, "Oversold", color=color.green, linestyle=hline.style_dashed)Pine's ta.stoch() returns the raw %K only — you smooth it yourself with ta.sma(). Setting smoothK=1 gives you Fast Stochastic; smoothK=3 gives the more common Slow Stochastic. Plotting both %K and %D with horizontal lines at 80/20 makes the standard crossover-in-extreme-zone setup visually obvious.
Stochastic compares the current close to the trading range over the lookback period, on a 0–100 scale. A signal line smoothed from %K provides crossover triggers.
Stochastic shines in ranging markets and fails in three regimes.
Strong directional trends produce extended overbought/oversold lockouts — Stochastic can stay above 80 (or below 20) for many bars during a trending move. Selling at 80 in a runaway uptrend is the most common failure.
Choppy, low-momentum sessions produce many false %K/%D crosses inside the 20–80 zone. The crossovers fire constantly without follow-through, and entries get whipsawed.
Very low timeframes (sub-1-minute) generate noisy %K readings dominated by tick-by-tick fluctuations rather than meaningful momentum. Use Slow Stochastic and longer lookback periods on these timeframes.
Pair Stochastic with a trend filter (200 EMA direction, MACD regime, ADX above 20) to gate signals to the prevailing market regime.
| Indicator | When to prefer |
|---|---|
| RSI | RSI is smoother and more popular for trend-aligned momentum reads. Stochastic is faster — better for very short timeframes and intraday range trading. |
| Williams %R | Williams %R is essentially Stochastic flipped (0 to −100 scale, no signal-line smoothing). Same information, different visual convention. Choose by preference. |
| MACD | MACD is unbounded and trend-following oriented. Stochastic is bounded 0–100 and mean-reversion oriented. Use MACD for trend trades, Stochastic for range entries. |
Fast Stochastic plots the raw %K line and its 3-bar smoothed %D signal. Slow Stochastic adds an extra 3-bar SMA smoothing on %K itself, then applies the 3-bar smoothing for %D — less noisy, fewer false crosses. Most modern charting platforms default to Slow Stochastic. Fast is more responsive but also more whippy.
The default %K=14, %D=3 works on most timeframes. For very short intraday (1–5 min), some traders prefer 9, 3, 3 for faster response. Going below %K=9 produces too many false signals to be useful. Pair with a higher-timeframe trend filter to gate signals.
Stochastic measures where the close sits within the recent high-low range. In a strong uptrend, the close is consistently near the high — so %K stays near 100 even as price keeps rising. The 80 threshold is a statistical level, not a reversal signal. Use trend filters to mute Stochastic signals during trending moves.
Use Stochastic for short-timeframe range trading and faster signal response. Use RSI for smoother momentum reads, divergence analysis, and trend-aligned entries. Many systems use both: RSI for the trend regime read, Stochastic for the timing trigger within that regime.
Continue exploring
Relative Strength Index
A momentum oscillator that measures the speed and magnitude of recent price changes on a bounded 0–100 scale.
View RSITrendMoving Average Convergence Divergence
A trend-momentum indicator built from the difference between two EMAs, plus a signal line and histogram that visualise momentum shifts.
View MACDVolatilityBollinger Bands
A volatility envelope built from a moving average and ±2 standard deviations, expanding and contracting as volatility changes.
View BBAbout these ideas
Each entry, exit, and utility rule in the Playbook is hand-picked from established trading literature, validated against historical backtests, and reviewed by the PineWiz team. We add new ideas as we encounter them and refresh existing ones when market behavior or default settings shift. Last review: .
Educational content. Not financial advice.