ADX / DMI

Three indicators in one — +DI and −DI measure trend direction; ADX measures trend strength. Together they answer 'is there a trend, and which way?'

IndicatorBy AlgoLiftUpdated 5 min read
On this page 13What it measuresFormulaInputs in AlgoLiftRecommended settingsOutputs in AlgoLiftReading the components togetherBest in / worst inThree setups1. ADX as a strategy gate2. DI crossover with ADX confirmation3. ADX-strength position sizingAdvanced patterns in AlgoLiftCommon mistakes

Three indicators in one bundle. +DI and −DI measure upward and downward directional movement separately. ADX measures the strength of whichever direction is dominant — regardless of which way the market is going. Developed by Welles Wilder in 1978.

What it measures

  • Trend strength (ADX). A single number from 0 to ~100 representing how strong the current trend is, regardless of direction. ADX above 25 = trending; below 20 = ranging.
  • Trend direction (+DI vs −DI). Two separate lines: when +DI is above −DI, the trend is up; when −DI is above +DI, the trend is down.
  • Direction-strength independence. ADX rises in both strong uptrends and strong downtrends. The +DI/−DI pair tells you which.

Formula

Inputs in AlgoLift

SettingDefaultRangeNotes
Period142–500Lookback for DMI and ADX calculations.
Smoothing MethodWilderWilder / EMA / RMA / SMA / WMAHow TR, +DM, and −DM are smoothed. Wilder is the original.
ADXR Lookback0 (disabled)0–500When > 0, computes the ADX Rating — average of ADX with ADX lookback bars ago.
  • (14, Wilder) — default. Standard for daily and intraday alike.
  • (7, Wilder): Faster — for short-timeframe trading.
  • (20, EMA): Smoother — for slow swing strategies.

Outputs in AlgoLift

HandleTypePlottedNotes
+DINumericAlwaysPositive directional indicator (0–100).
−DINumericAlwaysNegative directional indicator (0–100).
ADXNumericAlwaysTrend strength (0–100).
DXNumericOn selectUnsmoothed ADX — raw bar-by-bar trend strength.
ADXRNumericOn selectADX Rating — average of ADX now and ADX adxr_lookback bars ago.
DI DifferenceNumericOn select+DI − −DI. Positive = bullish, negative = bearish.
DI RatioNumericOn select+DI / −DI. > 1 = bullish, < 1 = bearish.

Reading the components together

The standard interpretation framework:

  • ADX < 20: No trend. Range-bound conditions. Mean-reversion strategies favored.
  • ADX 20–25: Transitional. Trend may be forming or fading.
  • ADX > 25: Trending. Trend-following strategies favored.
  • ADX > 40: Strong trend. Trend-following strategies likely to perform exceptionally; mean-reversion strategies likely to lose.
  • ADX falling from > 40: Trend is exhausting. Often precedes consolidation or reversal.
  • +DI > −DI: Direction is up (when ADX confirms a trend exists).
  • −DI > +DI: Direction is down.
  • +DI/−DI crossover: Direction shift signal (most useful when ADX is above 20).

ADX alone tells you nothing about direction. +DI vs −DI alone tells you nothing about whether the direction is meaningful. The combination is what makes the indicator useful.

Key Takeaway

ADX is unique among indicators — it's a regime classifier (trending vs. ranging) and a trend-strength gauge in one number, with the direction information available separately. Use ADX as the meta-filter that decides which strategy type to run, then use +DI/−DI for the actual direction.

Best in / worst in

Best in instruments with clear regime transitions (most major futures and equity indices), and as a portfolio-level filter that decides whether trend or mean-reversion strategies should be active.

Worst in extremely fast-moving markets where ADX can spike to 50+ on a single news event without representing a sustained trend, and in very-low-timeframe analysis where the 14-period default produces too much lag.

Three setups

1. ADX as a strategy gate

The classic use — turn other strategies on/off based on ADX regime.

  • Trend strategy active when: ADX > 25.
  • Mean-reversion strategy active when: ADX < 20.
  • Both paused when: ADX between 20 and 25 (transition zone).

A single ADX check can radically improve a portfolio's stability.

2. DI crossover with ADX confirmation

Direction signal with strength confirmation.

  • Long: +DI crosses above −DI AND ADX > 20 (trend exists) AND ADX slope > 0 (trend strengthening).
  • Short: −DI crosses above +DI AND ADX > 20 AND ADX slope > 0.

The ADX-slope-positive requirement is what separates this from noise — a DI crossover during weakening ADX is much lower quality.

3. ADX-strength position sizing

Scale position size to trend strength.

  • Position size = base_size × (ADX − 20) / 30, clamped between 0 and 1.5× base.
  • When ADX = 20 (boundary), size = 0 (no trade).
  • When ADX = 50 (strong trend), size = 1.0 (full base).
  • When ADX = 65 (very strong), size = 1.5 (oversized).

Combined with fixed-fractional risk math, this puts more capital behind trades when the trend backdrop justifies it. See position sizing.

Advanced patterns in AlgoLift

ADX-driven regime switching. Let ADX decide which strategy runs. In regime mode, give a "Trending" regime the detection condition ADX > 25 ending in an Activate Regime node, with a trend-following entry on its canvas, and a "Ranging" regime ADX < 20 with a mean-reversion entry. One strategy then adapts to the market it's in. Without regime mode, AND each entry with its own ADX condition.

ADX as a scaled entry accelerator. Take the initial position on a DI crossover. Use Scale-In Entry to add when ADX crosses 30, then again at 40 — the strategy scales up as the trend confirms itself. Effective in instruments that produce extended directional runs.

ADXR as a trend-exhaustion exit. ADXR (ADX Rating) is the average of current ADX and ADX from N bars ago. When current ADX has fallen below ADXR, the trend is exhausting. Enable ADXR Lookback (set to 14) and use this comparison as an exit trigger via Set Exit Condition.

Multi-timeframe ADX agreement. Add a 1h data series alongside your 5m execution. Only allow trades when both timeframes' ADX > 25 AND both DI pairs agree on direction. The dual-timeframe filter eliminates trades against the higher-timeframe context.

Common mistakes

  • Reading ADX as a direction indicator. ADX is direction-agnostic. ADX rising means the trend is strengthening, but ADX itself doesn't say which way.
  • Treating ADX > 25 as universal "good time to trade." ADX > 25 is good for trend strategies. For mean-reversion strategies, it's bad — strong trends are exactly when mean-reversion fails.
  • Using +DI/−DI crossovers without ADX context. A DI crossover when ADX < 20 happens in chop — half the crossovers in a typical year are noise.
  • Optimizing the period below 7. ADX needs enough data to identify trend persistence. Below 7-period, the indicator essentially becomes raw price noise.
Common Misconception
Myth
High ADX means it's a good time to enter a trade.
Reality
High ADX means a *trend is in progress*. The trade should already be on. Entering when ADX is at 45 typically means entering near the end of the move, not the start. The best ADX-based entries are when ADX is *rising* from below 20 — the trend is forming and you're getting in early.