VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime

DMI (Directional Movement Index): +DI, −DI and their crossings

The Directional Movement Index draws two lines, +DI and −DI, that show how much of recent price movement has been pushing upward and how much has been pushing downward. Traders watch which line is on top and where the two cross. This page is about those two lines and their crossings: how they are built, why a crossover is a change of leadership rather than proof of a trend, and how a strategy generator can test crossover rules on your own contracts. Trend strength itself is covered on the ADX page.

FamilyTrend
OutputTwo directional lines, +DI and −DIUsually drawn in a separate panel, often together with ADX
In AlphaPrimeBuilt-in generator familyLeadership filters, crossover entries and line-turn exits

What it measures

The Directional Movement Index, usually shortened to DMI, is a pair of lines that compares upward and downward price extension. The positive directional indicator, +DI, rises when bars keep reaching beyond the previous high; the negative directional indicator, −DI, rises when bars keep reaching below the previous low. J. Welles Wilder introduced directional movement in his book New Concepts in Technical Trading Systems, published in the late seventies, the same book that brought Parabolic SAR and the Average True Range to traders. ADX is built afterwards from these same two lines, which is why the three are so often drawn together.

In words, the calculation runs one bar at a time. First it measures how far the current high climbed above the previous high, and how far the current low fell below the previous low. Only the larger of the two extensions is kept, and only if it is positive; the other side is recorded as zero for that bar. An inside bar, which reaches past neither the prior high nor the prior low, adds nothing to either side. The upward and downward extensions are then smoothed over the lookback with Wilder's own gradual averaging, and each is divided by the smoothed true range over the same stretch. Expressing each side as a share of the true range is what lets the lines be compared across contracts with very different price levels and tick values.

Because both lines are scaled by the same true range, they describe proportions, not prices. When +DI sits above −DI, recent bars have extended upward more than downward; when the lines swap places, leadership has changed hands. The distance between them shows how one-sided recent movement has been, and a narrowing gap shows the leading side losing its grip. What the lines do not tell you is whether that leadership will last, which is the question ADX was designed to answer.

Concept sketch (not real market data)

How it behaves in real markets

The most common misuse of DMI is treating a +DI/−DI crossover as a confirmed trend. A cross only says that, over the lookback, one side's extension has just edged past the other's. It can happen after a single wide bar, after a gap at the session open, or simply because the leading side faded while the other barely moved. Many crosses occur with both lines low and close together, a state in which neither side is really pushing. Treating that kind of cross as the start of a trend, and sizing the trade as if it were, tends to put a position on exactly when directional movement is weakest. A cross is better read as a change of leadership that still needs evidence: separation between the lines over the following bars, a rising ADX, or price breaking a level that matters.

When directional movement is weak, the two lines wind around each other. In a quiet range most bars overlap their neighbours, extensions on both sides are small, and the smoothed lines drift together until each minor swing pushes one of them slightly ahead. The result is a run of alternating crosses, each one undoing the last, and a crossover system that follows every flip gives a little back on each. Wilder himself attached a stop to the signal: for a buy he placed the initial stop at the low of the signal bar, and for a sell at its high. The signal stayed in force while that level held, even if the lines crossed back, so the stop rather than every re-cross decided the exit. Requiring a minimum gap between the lines, a few bars of persistence after the cross, or a separate regime check are the usual ways of thinning out these flips.

Choosing the lookback is a trade-off between how early a cross appears and how many crosses appear. A shorter lookback makes both lines react quickly to recent extensions, so crosses arrive sooner but flip more often in choppy markets. A longer lookback smooths the lines, keeps them apart for longer during a trend and reduces whipsaw, at the cost of crossing well after the turn. Because one setting drives both lines, it also changes how far apart they typically sit, so any gap threshold has to be chosen together with the lookback rather than on its own. Bar size matters as well: on intraday charts a session gap can dominate the smoothing, while on daily bars the lines move more slowly. Testing several lookbacks on the contract and timeframe you actually trade tells you more than borrowing a textbook default.

Common ways to use it (concepts)

Leadership filter

Trade in the direction of the leading line

Rather than acting on the cross itself, use the state: allow long rules only while +DI is above −DI and short rules only while −DI leads. DMI then becomes a direction filter for a separate entry, such as a breakout of a Donchian Channel, and stops reacting to every individual flip.

Confirmed cross

Cross plus follow-through

Treat a crossover as a candidate, not a signal. The entry waits until the new leader keeps rising for another bar or two, or until price trades beyond the extreme of the crossing bar. Crosses that reverse straight away never become trades, which removes a large share of the whipsaw described above.

Fading leader

Exit when the leading line turns down

While in a long trade, watch +DI rather than waiting for a full cross. When the leading line turns down as −DI starts to rise, the upward push is losing ground and the stop can be tightened. Scaling that stop to ATR keeps it in proportion to the current swing size.

Pairing it with other indicator families

The natural partner is ADX, since it is computed from the same two lines. DMI says which side leads; ADX says whether the lead is persistent. A cross that occurs while ADX is rising from a low level is a different event from a cross while ADX is flat and low, and separating the two is the simplest answer to the crossover problem described above.

A slower directional reference also helps. The slope of a moving average can define the side you are willing to trade, with DMI used only to time entries in that direction; crosses against the slope are ignored. Aroon offers a check from a different angle, since it looks at how recently highs and lows were set rather than how far bars extended.

Avoid stacking DMI with tools that measure almost the same thing. The Vortex Indicator also compares upward and downward thrust between consecutive bars, so its crosses often coincide with DMI crosses and add little new information. Pairing DMI with a volatility measure or a price-level breakout gives the rule an independent second opinion instead of an echo.

In AlphaPrime

In AlphaPrime, DMI is a built-in condition group of the strategy generator, listed as DMI. Its adjustable input is the indicator period, the lookback that drives +DI and −DI at once. Representative conditions include "+DI is above −DI" and "+DI is below −DI" for leadership, "+DI crosses above −DI" and "+DI crosses below −DI" for crossings, and "+DI is rising", "−DI is falling" or "+DI turns up" for the slope of either line on its own.

These conditions let the generator test the questions this page raises instead of assuming the answers. It can use a crossover as an entry, use the leadership state as a filter on another entry, or use a turn in the leading line as an exit, and it combines each with rules from other families. The GPU backtests the candidates in parallel, and you can set out-of-sample validation thresholds, so you keep only combinations that still hold up on data they have never seen, not ones that only worked during one trending stretch, which is exactly where crossover rules tend to look better than they are.

Combinations that pass can be exported as strategy code for trading platforms, with the DMI conditions written out alongside the other entry and exit rules, so you can read the logic, simulate it and decide whether to trade it.

FAQ

What is the difference between DMI and ADX?

DMI is the pair of directional lines, +DI and −DI, and it tells you which side has been extending further. ADX is derived from the gap between the two lines relative to their combined size, then smoothed again; it measures how persistent the lead is and ignores direction. Many traders read DMI for direction and ADX for strength.

Does a +DI cross above −DI mean an uptrend has started?

Not by itself. It means upward extension has just overtaken downward extension over the lookback. In a range this happens again and again without any trend following. Waiting for the lines to separate, for ADX to rise, or for price to trade beyond the crossing bar's high gives the cross more context before it is acted on.

Can a DMI-based strategy run on a trading platform?

Yes. When a combination built with DMI conditions passes out-of-sample validation, it is exported as strategy code for trading platforms, where you can review the conditions, simulate it and decide whether to take it live.