KDJ

A smoothed stochastic with an extra J line that reacts faster to turns.

KDJ: RSV = raw stochastic %K over length candles; K = RMA(RSV, k_smooth) and D = RMA(K, d_smooth) (the classic 2/3 – 1/3 recursion for 3, seeded with a simple average instead of a fixed 50); J = 3K − 2D. A flat window is not ready and restarts the smoothing. Mirror: midpoint 50 for K, D and J (J = 3K − 2D mirrors to 100 − J).

Settings

SettingDefaultRangeWhat it does
length91 to 500Candles of the high-low window.
k_smooth31 to 100Wilder smoothing length of K.
d_smooth31 to 100Wilder smoothing length of D.

What it gives

OutputWhat it is
KK, 0–100.
DD, 0–100.
JJ = 3K − 2D (can leave 0–100).

What it reads

It reads the whole candle (open, high, low, close and volume).

Warm-up

With its default settings, KDJ needs 69 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Related indicators

Built from: Stochastic

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses KDJ with its default settings