ADX (Average Directional Index): Measuring Trend Strength for Bots
ADX measures trend strength, not direction. How ADX, +DI and -DI are built, which thresholds traders use, and how bots use ADX as a regime filter for trend and range strategies.
Many strategies work only in one kind of market: breakouts and trend following need trends, mean reversion needs ranges. The Average Directional Index (ADX) is the classic tool for telling them apart. It measures how strongly a market is trending, regardless of direction, which makes it one of the most practical regime filters for trading bots.
How ADX is built
ADX is part of J. Welles Wilder’s Directional Movement System (1978):
- +DM / −DM - the part of today’s range above yesterday’s high (+DM) or below yesterday’s low (−DM), whichever is larger.
- +DI / −DI - smoothed +DM and −DM divided by ATR, as percentages. They show the strength of upward and downward movement.
- DX = |+DI − −DI| / (+DI + −DI) × 100.
- ADX = smoothed DX, classically over 14 periods.
So ADX rises when one direction dominates, whether up or down.
How to read it
| ADX | Typical reading |
|---|---|
| Below ~20 | Weak trend or range |
| 20-25 | Trend may be developing |
| Above ~25 | Trending market |
| Very high, then turning down | Trend maturing or pausing |
- +DI above −DI - upward movement dominates.
- ADX rising - trend strengthening; falling - weakening, even if price still moves in the trend’s direction.
How bots use ADX
Regime filter
- Trend and breakout bots: trade only when ADX > threshold (for example 20-25).
- Mean-reversion bots: trade only when ADX < threshold (for example 20).
A single filter like this often removes a large share of losing trades from the wrong regime.
Direction confirmation
Combine with +DI/−DI: longs only when +DI > −DI, shorts only when −DI > +DI.
Trend exhaustion warning
ADX turning down from very high levels can trigger tighter trailing stops rather than exits.
Building on ADX
ADX can be combined with moving averages into adaptive trend baselines. AlgoXP’s ADXVMA Aurora Trend Filter follows this idea: the baseline moves faster when ADX shows a strong trend and flattens when it does not.
A worked example
A breakout bot on XAUUSD H1 trades breaks of the 20-bar high or low. Without a filter it trades in every condition. With an ADX(14) > 20 filter on the bar before entry:
- the number of trades falls by roughly a third;
- most removed trades are false breakouts in flat ranges;
- expectancy per trade improves, while total profit may stay similar or rise slightly.
Test thresholds across a range (15-30) to confirm the improvement holds broadly and is not a lucky value.
Pitfalls
- Lag. ADX confirms trends late. Use it to allow or block trades, not to time entries.
- Threshold tuning. 23.7 is not meaningfully different from 25. Use round values from a stable region.
- Timeframe mismatch. ADX on M5 says little about the H4 trend your strategy relies on.
- Low-volatility trends. Slow, grinding trends can show modest ADX values while still being tradable.
Key takeaways
- ADX measures trend strength; +DI and −DI show direction.
- Use it as a regime filter: high ADX for trend strategies, low ADX for mean reversion.
- It lags - good for permission, poor for timing.
- Choose thresholds from a stable range and match the timeframe to your strategy.
FAQ
Does a high ADX mean an uptrend?
No. ADX is high in strong uptrends and strong downtrends. Direction comes from +DI versus -DI, or from price relative to a moving average.
What ADX level means a trend?
Common rules of thumb: below about 20 suggests a weak or absent trend, above about 25 a trending market. Treat these as starting points and test them on your market.
Why does ADX react so slowly?
It is a smoothed average of a smoothed measure, so it lags. That is acceptable for a regime filter but makes ADX a poor timing tool.
Sources and further reading
- StockCharts ChartSchool: Average Directional Index (ADX) - chartschool.stockcharts.com
- StockCharts ChartSchool: Average True Range (ATR) - chartschool.stockcharts.com