VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Indicators and signals

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 · Published · updated · Editorial policy

Contents
  1. How is the ADX indicator calculated?
  2. What ADX level shows a strong trend: 20 or 25?
  3. Is ADX better as a filter or a signal?
  4. Does ADX lag, and when does it give false readings?
  5. How do you test whether an ADX filter improves a trend strategy?
  6. What would an ADX filter have to beat on NQ daily bars?
  7. Frequently asked questions
  8. 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:

  1. 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.
  2. Smoothing. +DM, -DM and true range are each smoothed over 14 bars.
  3. 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.
  4. 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.

  1. ADX. DX is smoothed again over 14 bars. That second smoothing is why ADX moves slowly, which the lag section covers.
ADX is built in five steps: directional movement and true range, a 14-bar smoothing, the +DI and -DI lines, DX as the gap between them divided by their sum, and ADX as DX smoothed over 14 bars again. ADX has no sign; direction comes from the DI lines ADX has no direction Five steps, smoothed twice DM, TR Smooth ±DI DX ADX 14 bars 14 bars DX = gap ÷ sum × 100 Direction comes from +DI and −DI. So: pair ADX with a trend rule.
From one bar's high, low and close to ADX in five steps. ADX is built from the gap between the two DI lines and carries no sign.

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.
The common ADX bands are conventions from daily-bar work: below 20 no trend, 20 to 25 a trend forming, 25 to 40 trending, above 40 a strong trend that is often late; find your own level by sorting your trades ADX bands are conventions Common labels, 14 daily bars Above 40 25 to 40 20 to 25 Below 20 Strong, often late Trending Trend forming No trend 20 and 25 are habits, not facts. So: sort your trades to find yours.
The common ADX bands and the price phases they are meant to label. The 20 and 25 lines divide the same scale in two different places.

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.

QuestionADX as filterADX as signal
What triggers the entryThe trend rule (breakout, moving-average cross, channel)+DI crossing -DI, or ADX rising through 25
What ADX doesBlocks entries when ADX is below the levelCreates the entry
Effect on trade countFewer trades than the rule aloneIts own trade count
TimingEntry can be early; ADX only confirmsEntry arrives after the move began
What to measureAverage trade after costs before vs after the filterAverage trade after costs on its own
ADX as a filter versus as a signal: as a filter, the trend rule opens the trade and an ADX gate only allows or blocks it; as a signal, ADX crossing 25 opens the trade, which arrives late Use ADX as a filter Who opens the trade? Filter Signal Trend rule ADX gate Entry ADX crosses 25 Late entry A filter only allows or blocks. So: compare it to the rule alone.
Filter or signal: the same indicator plays two different roles, and each role is judged by a different comparison.

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.

Illustrative shape: price breaks out, rises, pauses and rises again; ADX crosses 25 about seven bars after the breakout and falls below 25 during the pause while the trend is still intact ADX confirms late Illustration Smoothed twice over 14 bars Price ADX 25 7 bars late Drops in pause ADX lags and dips in pauses. So: use two levels, 25 in, 20 out.
The two costs of double smoothing: ADX confirms a breakout late, and it drops below the threshold during a pause while the trend is intact (illustrative shape).

Three situations produce readings that mislead a strict threshold:

  1. 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.
  2. 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.
  3. 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.

  1. 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.
  2. Add the ADX filter at 20, 25 and 30 with nothing else changed.
  3. Compare trade count and average trade after costs for each version against the baseline.
  4. Check that neighbouring thresholds behave alike. If 25 helps and 20 and 30 both hurt, the result describes noise, not a trend measure.
  5. 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.
  6. 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.
Six steps to test an ADX filter: run the rule alone with costs and next-bar execution, add ADX at 20, 25 and 30, compare average trade and trade count, check that neighbouring thresholds agree, run walk-forward, and accept only if the out-of-sample result improves Test the filter in six steps Same costs, same data 1 2 3 4 5 6 Rule alone Costs, next bar Add ADX At 20, 25, 30 Compare Avg trade, count Neighbours All three agree Walk-forward Pick, then test Accept If OOS improves
The order of tests that lets you say a filter helped, rather than that it made one in-sample curve smoother.

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.

NumberFilter helpsFilter only removes trades
Trade countDownDown
Average trade after costsUp clearlyFlat or down
Max drawdownDownAbout the same
Out-of-sample resultSame direction as in-sampleIn-sample improves, out-of-sample does not
Neighbouring thresholds20, 25 and 30 all similarOnly one threshold works
Both kinds of filter cut trades; a filter that helps raises the average trade clearly, lowers drawdown, holds out-of-sample and agrees across neighbouring thresholds, while one that only cuts trades leaves the average trade flat, drawdown the same, fades out-of-sample and works at only one threshold Fewer trades is not proof Both cut trades. Then check: Helps Only cuts Avg trade Drawdown OOS Neighbours Up clearly Down Holds Agree Flat or down Same Fades One works Only out-of-sample gains count. So: keep it only if OOS holds.
Both columns cut trades. Only the left one earns its place: average trade and drawdown improve, the improvement survives out-of-sample, and neighbouring thresholds agree.

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.

NumberResult
Net profit (closed trades)$192,105
Max drawdown$71,325
Trades168
Win rate58.93%
Profit factor1.423
Average trade$1,143.48
Time in market56.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.

Hypothetical example: the baseline has 200 trades and a 300 dollar average trade; the passing filter has 130 trades, 450 dollars and a drawdown 30 percent below the baseline; the failing filter has 60 trades, 280 dollars and a drawdown only 5 percent below the baseline. A pass needs all three Hypothetical; drawdown vs baseline Baseline Passes Fails Trades Avg trade Drawdown 200 130 60 $300 $450 $280 100% 70% 95% Fewer trades alone proves nothing. So: check average and drawdown too.
The equity curve and drawdown of the unfiltered stand-in rule, with the out-of-sample stretch marked. Look at the depth and length of the largest drawdown and at whether the slope after the out-of-sample marker resembles the slope before it: those are the two things an ADX filter would have to improve without removing most of the 168 trades. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

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.