ADX indicator: calculation, 20 vs 25, and how to test a trend filter
ADX measures how one-sided recent movement has been, not its direction. The 20 and 25 levels are conventions, so test them on your own market and bar size, use ADX as a filter rather than an entry signal, and judge the filter by average trade after costs, trade count and drawdown on out-of-sample data.
By Soren Huang · Published · updated · Editorial policy
Contents
- How is the ADX indicator calculated?
- What ADX level shows a strong trend: 20 or 25?
- Is ADX better as a filter or a signal?
- Does ADX lag, and when does it give false readings?
- How do you test whether an ADX filter improves a trend strategy?
- What would an ADX filter have to beat on NQ daily bars?
- Frequently asked questions
- References
How is the ADX indicator calculated?
The ADX indicator measures how one-sided recent price movement has been, from 0 to 100, without saying which way price moved. It is built from the gap between two direction lines, +DI and -DI, smoothed twice over 14 bars. Readings above 25 are the usual sign of a trend; check that level on your own market first.
The average directional index (ADX) is a smoothed average of the distance between +DI and -DI, measured as a share of their sum. Think of a tug of war. +DI is the pull of the buyers, -DI is the pull of the sellers, and ADX tells you how lopsided the match is. It does not tell you which team is winning. A high ADX in a falling market means a strong downtrend, not a reason to buy.
The chain from one bar to the final number has five steps:
- Directional movement. +DM is today's high minus yesterday's high, kept only when that is larger than yesterday's low minus today's low and larger than zero. -DM is yesterday's low minus today's low under the mirror condition. True range is the largest of: today's high minus today's low, today's high minus yesterday's close, yesterday's close minus today's low.
- Smoothing. +DM, -DM and true range are each smoothed over 14 bars.
- Direction lines. +DI is smoothed +DM divided by smoothed true range, times 100. -DI is the same with -DM. Each line says how much of the bar range went its way.
- DX. The one formula worth remembering:
DX = |+DI − -DI| ÷ (+DI + -DI) × 100
Here |+DI − -DI| is the gap between the two lines with the sign removed, and (+DI + -DI) is their sum. When one line is 30 and the other 10, DX is 50. When both are 20, DX is 0, however busy the bars were.
- ADX. DX is smoothed again over 14 bars. That second smoothing is why ADX moves slowly, which the lag section covers.
Because every step is an exact arithmetic rule, ADX can be written into a strategy and tested without judgment calls, which is what separates it from drawn tools; the guide to technical analysis tools and indicators you can test sorts indicators on exactly that line.
What ADX level shows a strong trend: 20 or 25?
The 20 and 25 levels are conventions carried over from the original daily-bar work, not measured facts about any market, so the level that separates range from trend on your chart has to be found by sorting your own trades. The 1978 book that introduced directional movement (Wilder, 1978) worked with daily commodity bars and a 14-bar length. The round lines that traders later drew at 20, 25 and 40 are labels on that scale.
The common reading is:
- Below 20: no trend; movement has been roughly balanced.
- 20 to 25: a trend may be forming.
- Above 25: trending.
- Above 40: strong trend, often late in the move.
Two things move the useful level away from 25. The first is bar size. A 14-bar ADX on 5-minute bars looks back about one hour of trading and crosses 25 many times a day, while the same setting on daily bars looks back three weeks; the tests behind which indicator works for intraday trading show how much a threshold chosen on daily bars can mislead on short bars. The second is the market itself. An index future that spends most days drifting and a commodity that spends most days in long runs will sit at different average ADX values, so the same line means different things on each.
The honest way to find your level is to count. Run your trend rule without any filter, record the ADX value on each entry bar, sort the trades into buckets, and compute the average trade after costs in each bucket. The bucket boundary where the average trade changes most is your candidate threshold.
Hypothetical example
A breakout rule on daily bars produces 400 trades over ten years. Sorted by ADX at entry: 120 trades below 20 average −$40 after costs; 80 trades from 20 to 25 average $30; 150 trades from 25 to 40 average $110; 50 trades above 40 average $20. The jump sits at 25, so 25 is the first threshold to test as a filter. Had the jump sat at 20, that would be the level, whatever the convention says.
ADX is one of several ways to score how orderly recent bars were; an entropy indicator that measures market randomness asks the same question with a different formula and runs into the same threshold problem, so the bucket method above applies to it unchanged.
Is ADX better as a filter or a signal?
ADX works better as a filter that allows or blocks another rule's entries than as an entry signal, because a rising ADX tells you a move is already under way, not where it starts. A filter is a condition that must be true before another rule may open a trade; it never opens a trade on its own. A signal is the condition that opens the trade.
Used as a signal, ADX has two common forms, and both have a timing problem. A +DI crossing above -DI fires often in sideways markets, because the two lines sit close together there and swap places on small moves. An ADX rising through 25 fires only after the smoothed gap has widened for several bars, by which time the breakout bar is long gone. Used as a filter, the entry comes from the trend rule at its own time, and ADX only decides whether that entry is allowed. The trade can still be early; ADX confirms rather than triggers.
| Question | ADX as filter | ADX as signal |
|---|---|---|
| What triggers the entry | The trend rule (breakout, moving-average cross, channel) | +DI crossing -DI, or ADX rising through 25 |
| What ADX does | Blocks entries when ADX is below the level | Creates the entry |
| Effect on trade count | Fewer trades than the rule alone | Its own trade count |
| Timing | Entry can be early; ADX only confirms | Entry arrives after the move began |
| What to measure | Average trade after costs before vs after the filter | Average trade after costs on its own |
The filter role changes one number you must watch: trade count. Every trade the filter removes also removes a commission and a slippage charge, so a filter can raise the average trade after costs even when it removes winners and losers in equal measure. That is a real improvement in the cost picture, but it is a different claim from "ADX finds better trades". It also shrinks the sample. A filter that cuts 400 trades to 60 leaves too few trades to tell skill from luck, however good the average looks.
Does ADX lag, and when does it give false readings?
ADX is smoothed twice, so it crosses 25 several bars after a trend is visible on the chart, and it falls during a pause inside a trend even when the trend is still in place. Lag is the delay between an event in price and the moment the indicator reflects it. The 14-bar smoothing that ADX uses gives old bars about as much weight as a 27-bar exponential moving average would, and that weight is applied once to the directional movement and again to DX. A single bar of strong movement is therefore diluted twice before it reaches the ADX line.
Three situations produce readings that mislead a strict threshold:
- A pause inside a trend. Price moves sideways for a few bars, +DM and -DM both shrink, DX falls, and ADX follows it under 25. A filter that also closes positions when ADX drops would exit good positions at exactly the point where the trend usually resumes.
- A sharp reversal. ADX can stay high while price turns, because it only knows that movement was one-sided, not that the side changed. The DI lines cross, DX dips briefly, and ADX smooths the dip away.
- A very quiet market with one wide bar. A single large bar in a flat stretch lifts true range and both DM values at once, so the DI gap barely moves and ADX stays low, even though the chart looks like a breakout.
Each problem has a tested answer. Use two levels instead of one: allow entries above 25 but only block them again below 20, so a shallow dip does not flip the filter. Use the slope rather than the level, so "ADX rising" counts even at 18. Or shorten the period, which trades lag for noise. The same trade-off runs through every smoothed indicator; the VIDYA indicator that changes its smoothing speed with volatility is one attempt to shorten lag in trending stretches and lengthen it in quiet ones, and it pays for that with its own false starts. Whatever variant you choose, the test in the next section is the same.
How do you test whether an ADX filter improves a trend strategy?
Run the trend rule alone first, then with the ADX filter at a few thresholds, with the same costs and next-bar execution, and judge the filter by average trade after costs, trade count and drawdown on out-of-sample data rather than by the smoother in-sample curve. Out-of-sample data is the part of the history you did not use to choose the threshold. Walk-forward analysis is a test that chooses settings on one window of data, runs them unchanged on the window after it, moves forward, and repeats.
- Run the trend rule alone with commission, slippage and next-bar execution. Write down trade count, average trade after costs and maximum drawdown. This is the baseline.
- Add the ADX filter at 20, 25 and 30 with nothing else changed.
- Compare trade count and average trade after costs for each version against the baseline.
- Check that neighbouring thresholds behave alike. If 25 helps and 20 and 30 both hurt, the result describes noise, not a trend measure.
- Run walk-forward on the best filtered version, so the threshold is chosen on past windows and judged on the windows that followed; the method is laid out in walk-forward analysis: why one backtest is not enough.
- Accept the filter only if the out-of-sample average trade and the drawdown both improved on the unfiltered rule, and the trade count left is large enough to count as evidence.
Step 4 matters because testing three thresholds is already a small search, and the best of a search is flattered by selection: Bailey, Borwein, López de Prado and Zhu (2014) show that the more variants you compare on the same data, the more the winner's in-sample result overstates what follows. Park and Irwin (2007), reviewing decades of technical-rule studies, found that results reported without this kind of correction and without out-of-sample checks were the ones most likely to vanish. When the unfiltered rule and its ADX versions at 20, 25 and 30 are separate candidates in AlphaPrime (Valynox), the pass thresholds you set in strategy validation before the search decide which of them reaches the walk-forward step, so the filtered curve never gets accepted because it looked smoother after the fact.
| Number | Filter helps | Filter only removes trades |
|---|---|---|
| Trade count | Down | Down |
| Average trade after costs | Up clearly | Flat or down |
| Max drawdown | Down | About the same |
| Out-of-sample result | Same direction as in-sample | In-sample improves, out-of-sample does not |
| Neighbouring thresholds | 20, 25 and 30 all similar | Only one threshold works |
Hypothetical example
Baseline: 400 trades, average trade $60 after costs, max drawdown $18,000. ADX filter at 20: 320 trades, $70, $17,000. At 25: 240 trades, $95, $12,000. At 30: 170 trades, $90, $12,500. The three thresholds point the same way, so the filter passes step 4. Walk-forward with the threshold re-chosen each window gives an out-of-sample average trade of $80 against the baseline's out-of-sample $55, with a smaller drawdown. The filter is kept. Had the walk-forward result been $50 against $55, the in-sample gain would have been selection, and the filter would be dropped.
What would an ADX filter have to beat on NQ daily bars?
The run behind this article is the unfiltered baseline, not an ADX result. It tested a stand-in rule on NQ daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, with $20 commission and $10 slippage per trade: a CCI rule used as the only entry and exit, with no stop, no target and no filter of any kind. An ADX filter was not part of it. Its numbers show what an ADX filter laid on top of such a rule would have to improve on, following the six steps above.
Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.
| Number | Result |
|---|---|
| Net profit (closed trades) | $192,105 |
| Max drawdown | $71,325 |
| Trades | 168 |
| Win rate | 58.93% |
| Profit factor | 1.423 |
| Average trade | $1,143.48 |
| Time in market | 56.02% |
Two things about this run decide how to read it. First, it is the one candidate the search kept out of 1,024 it tried, chosen for its return against its drawdown. Picking the kept one after the fact flatters it: the rest did worse on that measure, and some of the gap between this candidate and the rest is luck that happened to line up with these years. Nobody should expect these figures from the rule, from CCI, or from NQ. Second, the rule tested is a stand-in built from a standard indicator, not an ADX rule, so nothing here says what ADX did.
Read as a baseline, the box sets three targets for a filter. The drawdown of $71,325 is the first: a filter that blocks entries in sideways stretches should cut it, and if it does not, the filter is not removing the trades that hurt. The trade count of 168 is the second: a filter that leaves 40 trades out of 168 over six and a half years has removed the evidence along with the trades. The average trade of $1,143.48 against $30 of costs per trade is the third: a filter earns its place by raising that figure out-of-sample, not by raising the in-sample profit factor above 1.423. AlphaPrime evaluates each candidate with fees, slippage and next-bar execution, so the filtered and unfiltered versions are compared on the same cost footing; the comparison still has to be made on the out-of-sample stretch, not the whole curve.
Your next step is the same whatever software you use. Take a trend rule you already have, run it with no filter, and write down its trade count, average trade after costs and maximum drawdown. Then sort its trades by the ADX value on the entry bar, find the bucket boundary where the average trade jumps, and test that level and its two neighbours as a filter through the six steps above. If the out-of-sample average trade and drawdown both improve, you have a filter. If only the in-sample curve got smoother, you have fewer trades and nothing else.
Frequently asked questions
What is a good ADX value for a trend?
The common labels are below 20 for no trend, above 25 for a trend and above 40 for a strong trend. These are conventions from daily-bar work, not measured facts about your market. Find your own level by recording ADX at the entry of each trade of your rule, sorting the trades into buckets and comparing the average trade after costs in each bucket.
Does ADX tell you the trend direction?
No. ADX only measures how one-sided movement has been, on a scale with no sign. Direction comes from the two lines it is built from: +DI above -DI means recent movement leaned upward, -DI above +DI means it leaned downward. A high ADX with -DI on top is a strong downtrend.
Does ADX lag price?
Yes, by design. ADX is smoothed twice over 14 bars, so it typically crosses 25 several bars after a breakout is visible on the chart and falls during pauses inside a trend. Using two levels, one to allow entries and a lower one to block them again, or using the slope of ADX rather than its level, reduces the damage; shortening the period reduces lag but adds false readings.
What ADX period should I use?
The original setting is 14 bars, and most tests start there. A shorter period reacts faster and crosses the threshold more often; a longer one is calmer and later. Test the period on your bar size the same way as the threshold: with the trend rule alone as baseline, neighbouring values compared, and the decision made on out-of-sample trades.
Can I use ADX on 5-minute bars?
You can, but the 25 level loses its daily-bar meaning. A 14-bar ADX on 5-minute bars looks back about one hour, crosses 25 many times a day and reacts to a single wide bar. Treat the level as unknown, sort your intraday trades by ADX at entry, and let the average trade after costs in each bucket show where the useful boundary sits on that bar size.
References
- Wilder, J. W. (1978). New Concepts in Technical Trading Systems. Trend Research.
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
- Park, C.-H., & Irwin, S. H. (2007). What Do We Know About the Profitability of Technical Analysis? Journal of Economic Surveys, 21(4), 786–826.

