Directional Movement Index (DMI): The DI Lines and ADX, Measured
The directional movement index is a comparison, not a forecast. Each bar, it asks how far price pushed past the previous high and how far it slipped under the previous low, then smooths whichever side won. Sitting on top of that pair, the average directional index throws the direction away and keeps only the size of the disagreement. Vike computes the whole family as batch_adx, one function in the trend group of our engine.
That single call hands back three aligned series: the ADX line, then +DI, then -DI. So the DMI and the ADX are not two indicators. They are one calculation read at two depths, which is why this page covers both.
What the directional movement index actually measures
Wilder's question was narrow, and answering it needs only two numbers per bar.
How much of today's high sits above yesterday's high? How much of today's low sits below yesterday's low? The larger of those two wins the bar outright, the loser is recorded as zero, and both are scaled against the bar's true range so a violent day and a quiet day contribute in proportion to their own size rather than in dollars. +DI is the running share of range that went into new highs. -DI is the same measurement pointed downward.
Neither line knows about the close. That surprises people, and it matters: a bar can finish deep in the red while still printing a fresh high, and the DMI will happily credit that bar to the upside.
The exact DMI arithmetic our engine runs
batch_adx runs, in order. One call returns all three lines, which is why the DMI and the ADX are described together here.Here is the whole computation, in the order batch_adx performs it.
For every bar after the first, take up = high - previous high and dn = previous low - low. Then +DM is up when up beats dn and is itself positive, otherwise zero; -DM mirrors that clause exactly. True range is the widest of three spans: the bar itself, the reach from yesterday's close up to today's high, and its drop down to today's low. Sum the first fourteen of each, then keep them current with Wilder's recurrence, which subtracts one fourteenth of the running total before adding the new bar.
How Vike computes it.batch_adxseeds three running sums over bars 1 through 14 — true range,+DMand-DM— and smooths each one ass += x[i] - s / 14. Note that it keeps sums, never means, so+DIis simply100 × pdm_sum ÷ tr_sum. TheDXfor each bar is100 × |+DI − -DI| ÷ (+DI + -DI), and the ADX is the plain mean of the first fourteenDXvalues followed by the same Wilder recurrence. Bar zero contributes nothing. Its true range and both movement values are zero by construction, so the seeds start at bar one.
I ported that rule out of the crate source and then checked it against the Python implementation the crate was itself ported from — fourteen symbols, 139,664 compared values, covering +DI, -DI, the ADX line and the batch_adxr relative. Largest absolute difference: 0.000e+00. Every warm-up mask matched bar for bar, so the two are bitwise identical, which is the only reason the measurements below are worth quoting at all.
Plus DM and minus DM: the rule most guides skip
One clause in that rule has a property nobody mentions, and it changes how the lines behave in quiet markets.
Both conditions are strict and mutually exclusive. If today's high extends by 3 and today's low extends by 5, then +DM is zero — not 3. The bar's upward push is discarded entirely rather than netted, because only the larger side is recorded. An inside bar, where the high is lower and the low is higher, produces zero on both sides at once, and an outside bar hands everything to whichever extension was bigger.
So a stretch of inside bars feeds zeros into both smoothed sums while true range keeps accumulating. Both DI lines sag toward the floor together, the gap between them narrows, and the ADX built on that gap sinks with them. The lines are not saying "no trend" there. They are saying "no new extremes", which is a different claim that happens to look identical on a chart.
Where the ADX line comes from, and when each series starts
Stacking a second smoothing on top of the first is the whole reason the ADX lags its own inputs.
DX measures how lopsided the two DI lines are right now, on a 0 to 100 scale: identical lines give zero, one line at zero gives 100. It is noisy, because it inherits the noise of both inputs and then divides. Wilder's answer was to average fourteen of them and smooth from there, which produces a line with no direction — the ADX rises whether price is climbing or collapsing, since it reads the distance between the DI lines and discards the sign.
Warm-ups fall out of that structure and are worth memorizing. Both DI lines land on bar 14. No ADX can appear until fourteen DX values exist, which puts it on bar 27. batch_adxr, which averages the ADX against its own value fourteen bars back, needs bar 41. Our engine emits nothing before each of those points, and the crate's registration advertises all three.
How to trade the DI crossover
Textbook advice puts the rule tightly enough to be proven wrong: go long when +DI crosses above -DI, and short on the mirror.
I scanned 275 Binance spot symbols, 358,342 daily bars, using our own detector rather than a chart package. Across 351,192 bars where both lines existed, the crossover fired 25,546 times — one signal every 13.7 bars, split almost perfectly at 12,816 bullish and 12,730 bearish. Each one resolved first-touch over the following ten bars against a 6% target and an 8% stop, with a bar that tagged both levels scored as a loss.
Long trades came back 6,823 wins to 5,255 losses, short trades 6,866 to 5,075. Read as percentages those are 56.5% and 57.5%. Risking eight to make six needs 57.1% just to break even before fees, so the long side finishes fractionally under water while the short side clears the bar by four tenths of a point. On the fourteen majors the MACD page scored, this same bracket returned 59.7% and 58.5% — better, on a sample eight times smaller, which is roughly what survivorship inside a liquid subset looks like.
Does ADX above 25 mean trending?
This is the single most repeated claim about this indicator, so I measured it rather than repeating it.
Start with how selective the threshold is. Across 350,917 daily bars the median ADX reading was 25.5, and of the 347,067 with a forward window I could test, 51.6% sat above 25. A condition that half the tape satisfies is a description of the tape rather than a filter on it.
Then test the claim itself. For every bar I computed the forward efficiency ratio over the next fourteen bars — net distance travelled divided by the sum of the individual moves, so 1.0 is a straight line and something near zero is the same ground walked repeatedly. Calling a window "trending" at 0.5 or better, bars with ADX above 25 trended 13.0% of the time. Bars below 25 trended 14.6% of the time. The famous filter has a forward lift of minus 1.5 points.
Run the identical ratio backward over the fourteen bars already closed and the picture inverts: 18.5% against 8.7%, a lift of nearly ten points. So the ADX is an excellent description of the recent past and, on this sample, tells you nothing whatsoever about the next fortnight. I use it now as a label for what already happened, never as permission to take the next trade.
Where the DMI fails
Now the uncomfortable half, and every failure shown here is a real signal this detector produced.
Whipsaw dominates. Of 25,271 consecutive crossover pairs, 12,436 were undone by the opposite cross inside five bars — 49.2%, with a median gap of six bars between one cross and its reversal. Half of all signals reverse almost immediately, each one a round trip through the spread.
Then there is the fix everyone recommends for that, which I expected to work. Demanding ADX above 25 at the moment of the cross cut the long sample from 12,816 to 2,756 and moved its hit rate from 56.5% down to 53.4%, while the 10,060 crosses the filter threw away scored 57.3%. The filter selected the worse half. Short trades did improve, from 57.5% to 58.4%, so this is not a clean verdict in either direction — but "confirm your cross with a strong ADX" cost money on the long side across the whole scan, and all three failures charted above printed an ADX in the high twenties or thirties. I learned to check what a filter discards before trusting what it keeps.
Is this the textbook Wilder DMI?
Yes, with one caveat that changes real numbers on real charts.
The structure is Wilder's 1978 original exactly. Where implementations diverge is the seed. Ours accumulates plain sums over the first fourteen bars and emits nothing before them; the other common convention runs a recursive average from bar zero with alpha of one fourteenth, so it prints an ADX on the very first bar and never admits it is mostly seed. Several popular charting libraries take that second route.
Both converge, and neither agrees early. On Bitcoin daily bars the gap between the two conventions was 6.4% of the ADX at bar 27, 2.6% at bar 40, 0.4% by bar 60, and invisible from bar 200 onward. More usefully, over 3,273 bars they disagreed about which DI line was on top exactly once, and about whether the ADX cleared 25 twice. Small, but not zero. When I see a cross on somebody else's chart that mine did not produce, the seeding convention is the first thing I look at.
Frequently asked questions
What is the average directional index?
It is the ADX. DX expresses how far apart +DI and -DI currently sit, and the average directional index is fourteen of those averaged together, then carried forward by Wilder's recurrence. Being two smoothings deep, it emits nothing before bar 27 at the default period, and batch_adxr pairs each reading with the one from fourteen bars earlier, so that series waits until bar 41.
What is the difference between DMI and ADX?
The DMI is the +DI and -DI pair, which carry direction. The ADX is derived from them and carries none — it measures only how far apart they are, which is why it rises in crashes as readily as in rallies.
Which DMI settings work best? Fourteen periods, and every figure on this page was measured on it. Shorter lookbacks multiply crossings without improving them, and at one signal per 13.7 bars there are already more than enough.
Is the DMI a leading indicator? No. Two stacked Wilder smoothings sit between price and the ADX line, so it can only describe closed bars — the measurement above shows its strength reading applies to the fortnight behind it, not ahead.
Should I use ADXR instead?
batch_adxr averages today's ADX with the reading fourteen bars ago, smoothing it further and delaying it further, and it needs 41 bars before printing anything. Treat it as a slower ADX rather than as new information about price.
Which indicator pairs well with the DMI? Something reading a different input. RSI normalizes gains against losses, the Stochastic Momentum Index locates the close inside a range, and a hammer is one unsmoothed bar — all three disagree with these lines in useful ways.
This is educational material, not financial advice. Every number here was measured on past bars, past behavior generalizes poorly, and trading carries real risk of loss — size any position so that being wrong stays affordable.