Skip to content

Stochastic

The Stochastic shows where within the recent range the price closed — closer to the highs or to the lows of the movement over the last candles. The result is a number from 0 to 100.

  • A value near 100 means the price closes at the top of the range (the market is “overheated”).
  • A value near 0 means the price closes at the bottom (the market is “oversold”).

The indicator has two lines: %K — the fast one, %D — its smoothed, slow version. Their crossovers give the main signals.

ZoneValueWhat it tells you
🔴 Overboughtabove 80The price is high in the range — the rally may run out of steam
⚪ Neutral zone20–80Ordinary movement, no clear skew
🟢 Oversoldbelow 20The price is low in the range — the decline may run out of steam

The most popular ways to apply the Stochastic in bots:

  • %K crosses %D from below to above — the fast line overtakes the slow one. Most reliable in the oversold zone (below 20).
  • Exit from the oversold zone — the Stochastic has risen back above 20: the decline is running out of steam, a bounce is starting.
  • %K crosses %D from above to below — the fast line drops below the slow one. Most reliable in the overbought zone (above 80).
  • Exit from the overbought zone — the Stochastic has dropped below 80: the rally is running out of steam.
%K = (Close - Lowest(Low, k_period)) / (Highest(High, k_period) - Lowest(Low, k_period)) * 100
%K = SMA(%K, k_smoothing) [if k_smoothing > 1]
%D = SMA(%K, d_period)
ParameterTypeDefaultRange / ValuesWhat it changes
D Periodint31-50Smoothing of the %D signal line
K Periodint141-50The length of the range used in the calculation. Smaller — more sensitive and more signals, larger — smoother
K Smoothingint11-10Additional smoothing of %K (1 — no smoothing)
TriggerDirectionConditionDescription
Level cross up🟢 BuyThe indicator value crossed the specified level from below to above.The indicator value crosses the specified level (level) moving from below to above. Used for crossing the zero level (RSI 50, MACD 0) or an arbitrary threshold.
Level cross down🔴 SellThe indicator value crossed the specified level from above to below.The indicator value drops below the specified level (level).
Value above level by N🟢 BuyThe indicator value rose above the level by the specified distance.Fires when the indicator value crosses the threshold (level + distance) moving up. Lets you delay entry until a breakout of the level is confirmed.
Value below level by N🔴 SellThe indicator value dropped below the level by the specified distance.Fires when the indicator value crosses the threshold (level - distance) moving down.
Value rising🟢 BuyThe indicator value is rising relative to the previous bar.The indicator value on the current bar is greater than on the previous one. The simplest indicator of upward momentum.
Value falling🔴 SellThe indicator value is falling relative to the previous bar.The indicator value on the current bar is less than on the previous one. The simplest indicator of downward momentum. Generates a signal on every declining bar.
Slope turns positive🟢 BuyThe indicator’s slope turned positive — an upward reversal.The derivative (slope) of the indicator line crossed zero from below to above, i.e. the indicator stopped falling and started rising. Signals a change in the direction of the indicator’s movement.
Slope turns negative🔴 SellThe indicator’s slope turned negative — a downward reversal.The derivative of the indicator line crossed zero from above to below, i.e. the indicator stopped rising and started falling.
K crosses D up🟢 BuyThe K line of the Stochastic / KDJ crossed the D line from below to above.The fast K line crosses the slow D line from below to above — a classic bullish Stochastic signal. Most reliable when the crossover occurs in the oversold zone (values below 20–30).
K crosses D down🔴 SellThe K line of the Stochastic / KDJ crossed the D line from above to below.The fast K line crosses the slow D line from above to below — a classic bearish Stochastic signal. Most reliable when the crossover occurs in the overbought zone (values above 70–80).
Enter overbought zone🔴 SellThe oscillator entered the overbought zone.The oscillator value crossed the overbought threshold from below to above. It means the price is rising actively and has reached an extreme level. In a countertrend strategy it can be used as a sell signal.
Enter oversold zone🟢 BuyThe oscillator entered the oversold zone.The oscillator value crossed the oversold threshold from above to below. It means the price is falling actively. In a countertrend strategy it can be used as a buy signal.
Exit overbought zone🔴 SellThe oscillator exited the overbought zone.The oscillator value returned below the overbought threshold. Signals a decline in upward momentum.
Exit oversold zone🟢 BuyThe oscillator exited the oversold zone.The oscillator value returned above the oversold threshold. Signals a decline in downward momentum.
ParameterTypeDefaultRange / Values
Level (Value above level by N, Value below level by N, Level cross up, Level cross down)float0
Distance (Value above level by N, Value below level by N)float00>
Overbought (Enter overbought zone, Exit overbought zone)float8050-100
Oversold (Enter oversold zone, Exit oversold zone)float200-50