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
| Setting | Default | Range | What it does |
|---|---|---|---|
| length | 9 | 1 to 500 | Candles of the high-low window. |
| k_smooth | 3 | 1 to 100 | Wilder smoothing length of K. |
| d_smooth | 3 | 1 to 100 | Wilder smoothing length of D. |
What it gives
| Output | What it is |
|---|---|
| K | K, 0–100. |
| D | D, 0–100. |
| J | J = 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