The KDJ indicator is a stochastic oscillator with a third line bolted on. That third line, J, is built from an extrapolation instead of an average, so it can print above 100 or below 0. A plain stochastic can't do that. This article derives the overshoot with numbers you can check by hand, explains what a J reading above 100 says in plain words, and sets out a test that tells you whether the third line earns its place on your chart. Quantzee treats the whole thing as analytical software output, not a signal to act on.
Every page that ranks for the kdj indicator prints the formula. Few ask what the arithmetic implies. That's the gap here.
From raw value to K, D and J: one bar carried all the way through
Start with the stochastic's raw value, usually called RSV. Over the last N bars (the default is 9), take the highest high and the lowest low. RSV is where the close sits inside that range, scaled to 0-100: RSV = (Close − Lowest Low) / (Highest High − Lowest Low) × 100. The step is the same one George Lane's stochastic oscillator uses, per the Wikipedia entry on the stochastic oscillator.
Next comes smoothing. The common KDJ setup uses a 1/3 weight: K = (2/3) × previous K + (1/3) × RSV, then D = (2/3) × previous D + (1/3) × K. K is the fast line, D is K averaged again. Both stay inside 0-100, because each is a weighted average of numbers that were already inside 0-100.
J is the odd one out: J = 3K − 2D. Nothing in that expression averages anything. Rewrite it and the meaning shows up: J = K + 2 × (K − D). J takes the fast line and adds twice the gap between the fast line and its own average.
Here's a constructed example, with invented prices used only to show the arithmetic. Take a 9-bar window with a highest high of 112 and a lowest low of 100. The close is 110.4. Previous K is 80 and previous D is 70.
- RSV = (110.4 − 100) / (112 − 100) × 100 = 86.67
- K = (2/3) × 80 + (1/3) × 86.67 = 53.33 + 28.89 = 82.22
- D = (2/3) × 70 + (1/3) × 82.22 = 46.67 + 27.41 = 74.07
- J = 3 × 82.22 − 2 × 74.07 = 246.67 − 148.15 = 98.52
Now carry it one bar further. The next close pushes to a new 9-bar high, so RSV = 100.
- K = (2/3) × 82.22 + (1/3) × 100 = 54.81 + 33.33 = 88.15
- D = (2/3) × 74.07 + (1/3) × 88.15 = 49.38 + 29.38 = 78.76
- J = 3 × 88.15 − 2 × 78.76 = 264.44 − 157.52 = 106.92
K is 88.15 and D is 78.76, both well inside the range. J is 106.92, outside it. No bug, no data error. That's the formula doing what it was written to do.
Why three times K minus two times D leaves the 0-100 range
An average of numbers in a range stays in that range. An extrapolation doesn't. J = K + 2 × (K − D) continues the line from D through K and keeps going for two more gap-lengths. If K is 88.15 and sits 9.39 points above D, J lands another 18.77 points past K.
The bound on K is 100, and D can lag well behind it. So whenever K is pulling away from D quickly and K is already high, J has room to cross 100. A cleaner way to see it is the run of closes where RSV pins at 100. Start with K and D both at 0:
- Bar 1: K = 33.33, D = 11.11, J = 77.78
- Bar 2: K = 55.56, D = 25.93, J = 114.81
- Bar 3: K = 70.37, D = 40.74, J = 129.63
Three straight bars at the top of the range send J to 129.63 while K is still at 70. The mirror image works on the downside. Start at K = D = 100 and let RSV sit at 0: J goes 22.22, then −14.81, then −29.63.
The overshoot is also temporary. If RSV stays at 100 long enough, K and D both converge on 100, the gap closes, and J comes back to 100. J doesn't measure how high price is. It measures how fast the fast line is running away from its own average.
What a J print above 100 says in plain words
A J of 106.92 doesn't mean price is 6.92% beyond anything. It says the fast line has run 9.39 points ahead of its average, and twice that distance has been added on top. In plain words: the last few closes have been pushed hard against the top of the N-bar range, harder than the smoothed D line has caught up with.
That's a statement about acceleration inside a range, nothing more. It doesn't say the move is exhausted, and it doesn't say it will continue. Many guides call a J above 100 overbought and a J below 0 oversold. Plenty of readers treat those as sell and buy cues. The arithmetic doesn't carry that conclusion. It tells you the gap between K and D is wide, which in a strong trend can stay wide for a while.
The same logic applies to RSI and CCI, and it's why we make the case that the bounded oscillators are not simple reversal gauges. See our write-up on what the CCI's ±100 lines actually mark, and the glossary entry on RSI (relative strength index) for the bounded cousin.
What is identical to a plain stochastic and what is new
Go term by term.
- Raw value (RSV): identical to the stochastic's raw %K. Same window, same high-low range.
- K line: this is the stochastic's smoothed %K when a 3-period smoothing is used. Same shape, same bounds.
- D line: the stochastic's %D, a further 3-period average of K. Also the same.
- J line: new. It adds no new price information. J is a fixed linear function of K and D, which are themselves functions of the same RSV.
That last point is the one most explainers skip. J cannot know anything K and D don't already know. It only rescales the distance between them. Two practical consequences follow. A J crossing above D is the same event as K crossing above D, just with a bigger swing in the number. And J crossing a level such as 100 or 0 is a threshold on K − D combined with K, not a threshold on price.
One software note: some platforms smooth with a different weight, and some seed K and D at 50 on the first bar. The numbers in this article use 2/3 and 1/3 weights, as most KDJ scripts do. Check your own script's source before you compare values across platforms.
Period settings: shorter lookback, more overshoot
The default is 9 bars, with 3 and 3 for the smoothing. The lookback only touches RSV. A shorter window means a narrower high-low range, so a given price move shifts RSV by a larger percentage. Take two cases, both with the lowest low at 100:
- 9-bar window with a highest high of 112: a move from a close of 106 to 110 shifts RSV from 50 to 83.3, a change of 33.3 points.
- 5-bar window with a highest high of 108 and the same low of 100: a move from a close of 104 to 108 shifts RSV from 50 to 100, a change of 50 points in one step, and RSV is now pinned at the cap.
The practical rule: a short lookback pins RSV at 0 or 100 more often. More pinned bars means K runs from D faster, and J overshoots more frequently and by more. A long lookback, say 21 or 34, keeps RSV off the edges, so J spends most of its time inside 0-100 and the overshoot becomes rare.
The trade is plain. Short settings give more early crossings and more noise. Long settings give fewer, later crossings. Nothing about the formula tells you which is right for a given symbol. That's an empirical question, and we come back to the design of the test below.
Timeframe interacts with this too. A 9-bar window on a 5-minute chart spans 45 minutes; on a daily chart it spans nearly two trading weeks. The same settings describe very different market behaviour.
The cost of trading J crossings inside a trend
This is where the extrapolation hurts. In a sustained trend, close after close lands near the top of its N-bar range, RSV stays high, and K sits near 100. D lags beneath it. J then spends long stretches above 100. Every pullback of a few bars drops RSV, K dips, D keeps rising slowly, and J falls fast, often crossing back under D or under 100.
A rule such as "exit or fade when J falls back below 100" will fire repeatedly during a single advance. Each signal is correct in the sense that the arithmetic changed, and wrong in the sense that the trend resumed. The extrapolation amplifies pullbacks as well as pushes. Each of those false exits is a round-trip with a spread and a commission attached. On a short-lookback setting those costs stack up quickly.
Filters that reduce the damage are well known and none is magic:
- A trend filter on a higher timeframe. Only take J crossings in the direction of a longer moving average slope, and skip the counter-trend ones. Our glossary entry on momentum trading covers why momentum signals behave differently inside and outside trends.
- A confirmation bar. Require the cross to hold on the close of the next bar. This costs a bar of delay and removes some one-bar whipsaws.
- A minimum gap. Ignore crossings where K − D is under some number of points at the time of the cross. It stops the near-flat crossovers that happen when the lines are tangled.
- Use closed bars only. A J value computed mid-bar can print above 100 and then fall back before the bar closes. That is a repainting problem; see how to test a TradingView indicator for repainting.
Each filter trades signals for lag. Treat them as hypotheses to test, not fixes.
Divergence on J versus divergence on K
Divergence means price makes a new high while the oscillator doesn't. Traders read it on J because J's swings are wider and the peaks look sharper. That's a visual effect. J's peaks are a stretched copy of K's peaks, so a divergence on J almost always shows up on K at the same bars.
The difference is in the noise. J exaggerates every small wiggle in K − D, and those wiggles create peaks that K itself wouldn't show. So J can show a lower high where K shows only a flat top, and you get a divergence that isn't there on the fast line. K gives the more honest read. If a divergence only exists on J and vanishes on K, it is the extrapolation talking.
It's also worth knowing that divergence in any bounded oscillator is a weaker tool than most guides suggest. The FINRA investor education pages are a fair reminder that chart patterns are not predictive guarantees, and the investor.gov glossary entry on technical analysis describes the approach as one based on past price and volume with no assurance about the future.
A test design: does the third line add anything over a plain stochastic?
Because J is a function of K and D, the question isn't whether J contains new information. It can't. The question is whether the J-based rule produces better outcomes than the same rule written on K and D alone. Here's a test setup that answers it on your own symbol. Everything below is a design to run yourself; no result is claimed in this article.
- Pick one symbol and one window. Name them before looking at any result, for instance one liquid index ETF over 2018-2025 on daily bars. Hold out the last 20% of the dataset and don't touch it until the end.
- Write two rules that differ only in the trigger. Rule A enters on a K/D cross. Rule B enters on J crossing a threshold (100 or 0) or crossing D. Same stop, same exit, same position size, same costs.
- Run each across a grid of lookbacks. Try 5, 9, 14, 21 and 34 bars. If rule B only wins at one setting, that's curve-fitting, not edge.
- Count trades and costs first. Rule B will almost certainly take more trades on short lookbacks. Compare after realistic costs, not before.
- Check stability. Split the sample into two halves. If the winner flips between halves, you have noise.
- Validate on the held-out slice once. One look. If it fails, the third line did not help on this symbol.
That process is what Quantzee's tooling is built around: parameters declared first, results read after. The same methodology applies to any oscillator. A positive outcome on one symbol doesn't carry over to another, and a negative one is a result, too.
How to read all of this on a live chart
Put K, D and J on the same pane with the 0 and 100 lines drawn. When J is outside the band, check K and D. If K is also near 100 and D is climbing, you're looking at a trend that's running, not necessarily one that's ending. If J is outside the band but K is mid-range, a sharp one-bar jump in RSV probably did it, and it's likely to fade within a bar or two.
Then ask what the setting is. A J above 100 on a 5-bar window is common. A J above 100 on a 34-bar window is rarer and carries more weight, since RSV had to stay near the top of a long range for several bars to produce it.
None of this is an instruction to buy or sell. It is a way to read what the line is saying, and a reminder to paper trade any rule before risking money on it.
Frequently Asked Questions
Related reading: momentum trading, RSI, and the CCI overbought/oversold myth. Quantzee provides analytical software, not investment advice.
