What is the ADX indicator? Formula, meaning and a backtest

On this page

Key takeaways

  • ADX, the average directional index, measures how strongly a price is trending, not which way: a fast fall raises it as much as a fast rise.
  • It is built from two companion lines. One tracks how far each day's high pushes above the day before, the other how far each low pushes below; ADX rises when one of them clearly dominates.
  • A common reading treats a value above 25 as a trending market. That level is a convention from Wilder's book, not a tested boundary.
  • Used alone in a long-only rule, it holds through strong declines as readily as strong rallies, because it cannot tell them apart. Traders pair it with a direction signal.
  • It is slow by design: it averages an average, so it confirms a trend after the move is well under way.

Definition

The average directional index (ADX) measures the strength of a price trend on a scale of 0 to 100 without saying whether the trend is up or down; J. Welles Wilder introduced it in 1978 together with its two directional lines, +DI and −DI. It averages how far apart the upward and downward movement lines are, so it rises in a strong move in either direction and falls when the market drifts sideways.

Also known as: ADX, ADX indicator, directional movement index, DMI, +DI and -DI, trend strength indicator, Wilder ADX.

How it works

Wilder started from directional movement. Compare today's bar with yesterday's: the up-move is how far today's high rose above yesterday's high, the down-move how far today's low fell below yesterday's low. Only the larger of the two counts, and only if it is positive; a day inside the previous day's range counts as no directional movement at all. Over many days, the sum of the up-moves says how hard buyers pushed the price to new highs and the sum of the down-moves how hard sellers pushed it to new lows.

Each sum is divided by the average true range over the same days, which turns them into the two directional indicators, +DI and −DI, both in percent of the market's normal daily movement. When one line sits far above the other, the market is moving persistently one way. The directional index DX measures exactly that gap, the difference between the two lines over their sum, and ADX is Wilder's smoothed average of DX.

Because the difference is taken as an absolute value, the sign is thrown away. A steady rally with +DI far above −DI and a steady sell-off with −DI far above +DI give the same ADX. That is the point of the indicator, a gauge of trend strength that a trader combines with something that gives the direction, such as +DI against −DI or a moving average.

ADX is like the wind speed on a weather report without the wind direction: it tells a sailor whether there is enough wind to go anywhere, not where it would take the boat.

The double smoothing makes ADX slow. It needs a sustained move to rise and keeps rising for a while after a trend has started, and it starts to fall when the trend loses pace, even if prices keep going the same way. A falling ADX therefore means a weakening trend, not necessarily a reversal.

Formula

Directional movement of day t
ut=Ht−Ht−1,dt=Lt−1−Lt+DMt={utut>dt and ut>00otherwise,−DMt={dtdt>ut and dt>00otherwise
Hₜ, Lₜ
the high and low of day t
uₜ, dₜ
the up-move and the down-move
+DMₜ, −DMₜ
plus and minus directional movement; on a tie both are 0
Directional indicators, DX and ADX
+DIt=100W(+DM)tW(TR)t,−DIt=100W(−DM)tW(TR)t,DXt=100|+DIt−(−DIt)|+DIt+(−DIt),ADXt=W(DX)t
W(·)
Wilder's smoothing over n days: an exponentially weighted average with weight 1/n on the newest day
TR
the true range: the largest of high − low, |high − previous close| and |low − previous close|
+DIₜ, −DIₜ
plus and minus directional indicators, in percent
DXₜ
directional index: the gap between the two lines as a share of their sum, 0 when both are 0
ADXₜ
average directional index, 0 to 100
n
the period: 14 by default
The long-only rule tested here
st={1ADXt>θ0otherwise,rt+1rule=st·rt+1
θ
the threshold: 25 by default
sₜ
the position decided at the close of day t: 1 = hold, 0 = cash
rₜ₊₁
the fund's total return on the next day

The mirror rule holds when ADX is below θ. Each day belongs to exactly one of the two, so with no trading costs the growth of the two rules multiplies to the growth of buy-and-hold.

Worked example

SPY daily bars from Oct 2006 to Sep 2026, about 20 years. The trend rule holds SPY for the next day while the 14-day ADX closed above 25, otherwise cash; its mirror image holds SPY only while ADX closed below 25. No trading costs.

SPY's ADX had a median of 21.75 over the window and closed above 25 on 35.2% of days. The trend rule was invested 35.2% of the time and the mirror rule 64.8%: between them they split the window, each holding exactly the days the other skips.

The trend rule grew 4.5% a year with a worst decline from a peak of -36.4% and a Sharpe ratio of 0.37. The mirror rule grew 6.4% a year with a worst decline of -40.1% and a Sharpe ratio of 0.55. Holding SPY throughout grew 11.1% a year with a worst decline of -55.2%.

Because each day's return went to one rule or the other, their results multiply back to buy-and-hold: $10,000 became $24,075 under the trend rule and $34,181 under the mirror rule, and the first times the second, divided by $10,000, gives buy-and-hold's $82,292 apart from rounding. Whatever one side earned, the other did not.

The trend rule made 83 round trips, 4.2 a year, and it held SPY through parts of the 2008 and 2020 crashes, when ADX was high precisely because prices were falling fast. Lowering the threshold to 20 raised the time invested to 59.0% and gave 8.7% a year. None of these rows is a strategy on its own; ADX needs a direction signal beside it, which a single-indicator rule cannot add.

Data through Sep 2026. Reproduce id 557b7b205f69c8fe (this guide, its lab setup and the data month).

Interactive lab

SPY's price with the days each rule held it shaded, ADX underneath with the threshold line, and the results of the trend rule, its mirror image, the lower threshold and buy-and-hold over the same days. Change the period, the threshold, the delay, the cost or the fund.

SPY price with the days the base rule held itS&P 500, adjusted daily close, Oct 2006 to Sep 2026, log scale. Shaded: the 83 stretches the base rule held the fund (35% of 5030 days).$50$100$200$50020062011201620212026SPY adjusted closeHeld by the base rule
SPY on a log scale. Shaded: the days the base rule held the fund. Oct 2006 to Sep 2026.
ADX with the base rule's lineADX on SPY, Oct 2006 to Sep 2026. The rule compares it with the fixed line 25.101520253035404550552006201120162021202625ADX
ADX and the line the base rule compares it with. Oct 2006 to Sep 2026.
Growth of $10,000: the setups against buy and holdS&P 500, Oct 2006 to Sep 2026, log scale. $10,000 grows to $24,075 (base), $34,181 (ADX below 25 (mirror)), $52,751 (ADX above 20), $82,292 (buy and hold).$10k$20k$50k20062011201620212026Base ruleADX below 25 (mirror)ADX above 20Buy and hold
Growth of $10,000 on a log scale, same days for every line. Oct 2006 to Sep 2026.
MeasureBaseADX below 25 (mirror)ADX above 20Buy and hold
CAGR4.5%6.4%8.7%11.1%
Volatility (annualized)14.9%12.6%17.0%19.4%
Maximum drawdown-36.4%-40.1%-41.2%-55.2%
Sharpe ratio0.370.550.580.64
Sortino ratio0.530.760.82n/a
Growth of $10,000$24,075$34,181$52,751$82,292
Time in the market35.2%64.8%59.0%100.0%
Round trips8382102n/a
Round trips per year4.24.15.1n/a
Win rate62.7%62.2%67.6%n/a
Average win3.2%6.1%3.8%n/a
Average loss-2.3%-5.4%-2.5%n/a
Payoff ratio1.391.111.53n/a
Average days held21.338.929.1n/a
Expectancy per trade1.2%1.7%1.7%n/a
Profit factor, per day1.141.131.161.13
Profit factor, per trade2.401.833.19n/a
Indicator, last day9.959.959.95n/a
Indicator, 10th / 50th / 90th percentile13.828 / 21.754 / 33.89713.828 / 21.754 / 33.89713.828 / 21.754 / 33.897n/a
Days the rule alone is long35.2%64.8%59.0%n/a

S&P 500, Oct 2006 to Sep 2026, 5030 trading days. Every setup is measured over the same days, with the indicator warmed up on earlier ones; cash earns 0. Base: ADX (Average Directional Index) (period 14); long while the ADX is above 25; execution delay 1; cost 0 bps one way. ADX below 25 (mirror): ADX (Average Directional Index) (period 14); long while the ADX is below 25; execution delay 1; cost 0 bps one way. ADX above 20: ADX (Average Directional Index) (period 14); long while the ADX is above 20; execution delay 1; cost 0 bps one way.

Buy and hold, same daysValue
Largest one-day gain14.5% on 13 Oct 2008
Largest one-day loss-10.9% on 16 Mar 2020
CAGR without the 10 largest gains6.6%
CAGR without the 30 largest gains1.8%
CAGR without the 10 largest losses16.0%
CAGR without the 30 largest losses22.1%

The days replaced by 0 are the largest daily gains (or losses) of the window.

How MarketHeist computes it

Every choice an implementation has to make, as the code makes it today. The page is checked against the code each time it is built.

ChoiceHow it is computedIn the code
DataDaily bars (open, high, low, close, volume) of the fund as the MarketHeist data service serves them to the backtester: prices adjusted for splits and dividends, so a dividend counts as reinvested. They come from a snapshot taken each month and cut at the data month of this page, and are not rounded. The fund's own history, not an extension: a fund younger than the window is measured over the years it has.
WindowThe worked example and the lab measure the last 20 years of trading days, Oct 2006 to Sep 2026 (5030 days), ending at the data month of this page. Every setup, and buy and hold, is measured over exactly these days; an indicator is warmed up on the days before them, so changing a setting never moves the window, and a setting that needs more history than exists before the window is refused rather than measured over fewer days.
BacktestThe backtester's own engine, in the order it runs it: the indicator, the position rule (or entry and exit triggers) and the optional regime filter produce a position for every day of the fund's whole history; the position is then shifted forward by the execution delay and applied to each day's return over the window. Cash earns 0, there is no leverage, and a one-way cost in basis points is charged on the size of every change of position. Round trips are the closed entries of the trade log (a trade still open on the last day is not counted); the win rate is the share of them with a gain; the payoff ratio is the average win over the size of the average loss; expectancy is the average return per trade; the per-trade profit factor is the sum of the winning trades' returns over the size of the sum of the losing ones, while the per-day profit factor sums days.
Years and volatilityA year is 252 trading days, the engine's convention: trades per year is round trips over days divided by 252, the CAGR is the growth multiple to the power 252 over the days, and volatility is the sample standard deviation of the daily returns times the square root of 252.
Indicator statisticsThe indicator's main output over the window: its last value, its 10th, 50th and 90th percentile (linear interpolation between ranks), and the share of days the rule alone says long, before the delay and any regime filter. Every output of the indicator is also summarized by its median and the share of days below 0.
Buy and holdThe fund held every day of the window with dividends reinvested. The largest one-day gain and loss are the highest and lowest daily returns; the CAGR without the 10 or 30 largest gains (or losses) replaces those days' returns with 0 and recompounds.
Directional movement+DM is today's high minus yesterday's high when that is larger than yesterday's low minus today's low and above zero, otherwise 0; −DM is the mirror image; a tie gives 0 to both. The first bar has no directional movement.computepackages/shared/engine/indicators/adx.ts
True rangeThe largest of high − low, |high − previous close| and |low − previous close|, the same as in the ATR indicator; high − low on the first bar.computepackages/shared/engine/indicators/adx.ts
SmoothingTrue range, +DM and −DM are each smoothed with Wilder's average: an exponentially weighted mean with weight 1/period on the newest bar, normalised over the bars seen so far (pandas ewm with adjust=True), defined from the period-th bar. ADX is the same smoothing applied to DX, so its first value comes about twice the period into the data. After a long history this matches Wilder's recursive sums; the first few dozen bars differ.ewmMeanAlphapackages/shared/engine/utils.ts
DI and DX+DI and −DI = 100 × smoothed DM / smoothed true range; DX = 100 × |+DI − −DI| / (+DI + −DI), and 0 when both lines are 0. A bar whose smoothed true range is 0 has no value.computepackages/shared/engine/indicators/adx.ts
What the rule readsADX is the primary output; +DI and −DI are computed alongside it but a single threshold rule reads ADX only. Period from 2 to 200, default 14; default rule long above 25.SPECpackages/shared/engine/indicators/adx.ts
PricesDaily bars with the dividend-adjusted close and the open, high and low scaled by the same per-bar factor, so a dividend does not appear as a new low.yahooResultToRowspackages/platform/ohlcv.ts
Timing, costs and cashThe position decided at a bar's close is applied to the next bar's return (execution delay 1); no trading costs unless set; cash earns 0.runBacktestpackages/shared/engine/backtest.ts
Engine functionsThe functions the portfolio app and the MarketHeist MCP tools run, called here on the same monthly returns.computePositionpackages/shared/engine/run_basic.tsgeneratePositionpackages/shared/engine/positions.tsapplyRegimeFilterpackages/shared/engine/regime_filter.tsgenerateTriggeredPositionpackages/shared/engine/triggered_position.tsrunBacktestpackages/shared/engine/backtest.tsgetIndicatorpackages/shared/engine/indicators/registry.ts

Average directional index (ADX) compared with its neighbours

ADX and the indicators it is usually paired with
IndicatorAnswersDirectionTypical use with ADX
ADXHow strong is the trend?NoFilter: act only when a trend is present
+DI and −DIWhich side is pushing harder?YesDirection: long when +DI is above −DI
Moving-average crossoverIs the price above its trend?YesDirection signal, with ADX to skip sideways markets
ATR%How much does the price move in a day?NoSizes stops; says nothing about trend
RSIHow stretched is the recent move?Yes, as overbought or oversoldMean reversion when ADX is low

Limitations

  • ADX has no direction. A long-only rule that reads ADX alone holds through sharp sell-offs, because a crash is a strong trend.
  • It lags. The double smoothing means ADX rises well after a trend begins and stays high after it has started to fade.
  • The thresholds are conventions. Levels such as 20 and 25 come from Wilder's commodity charts; how often a fund crosses them depends on the fund, the period and the smoothing length.
  • Small numerical differences from other platforms are expected. Wilder seeded his averages with a plain sum and rounded by hand; charting packages differ in how they start the smoothing, which matters in the first few dozen bars of a chart.
  • The test ignores trading costs, spreads and taxes, earns nothing on cash and describes one historical path of one fund.

Frequently asked questions

What ADX value means a strong trend?
Wilder's convention reads above 25 as a trending market and below 20 as a sideways one, with higher readings for stronger trends. These are rules of thumb; look at where the fund's own ADX usually sits, as the median in the worked example shows.
Does a falling ADX mean the trend is reversing?
Not necessarily. ADX falls when the trend loses pace, for example when a rally keeps rising but more slowly or pauses. A reversal shows up in the directional lines crossing, or in the price itself.
Why was ADX high during a crash?
Because a crash is a strong, persistent move: day after day the lows push well below the previous lows, so −DI dominates and the gap between the lines is wide. ADX measures that gap and ignores which line is on top.
What is the difference between ADX and DMI?
DMI, the directional movement index, usually means the full set of lines: +DI, −DI and ADX. ADX is the trend-strength line within it.
How do traders combine ADX with a direction signal?
A common pattern is to require both: a trend is present (ADX above a level) and it points up (+DI above −DI, or the price above a moving average). In the backtester that takes two conditions, for example two entry triggers combined so that both are required.

References

  1. Wilder, J. W. (1978) New Concepts in Technical Trading Systems. Trend Research. Directional movement, +DI, −DI, DX and ADX, and the average true range.
  2. Kaufman, P. J. (2013) Trading Systems and Methods. Wiley, fifth edition. ADX as a trend filter and its lag.
  3. Brock, W., Lakonishok, J. and LeBaron, B. (1992) Simple Technical Trading Rules and the Stochastic Properties of Stock Returns. Journal of Finance 47(5). The trend rules ADX is usually combined with.

Try it on your own holdings

Run the ADX rule on SPY in the backtester →

Or ask an assistant connected to the MarketHeist MCP server (https://marketheist.io/mcp), which computes the same figures:

Using MarketHeist.io, backtest SPY on daily bars with ADX (14): hold SPY while ADX is above 25, otherwise cash, one-bar delay, no costs, over the last 20 years. Then run the opposite rule (ADX below 25) and compare both with buy-and-hold.

Ask an AI assistant

The prompt opens in a new tab, already filled in. An assistant without the MarketHeist connector answers from its own knowledge, not from the figures on this page.

Historical simulation, not advice. Computed by the MarketHeist portfolio engine from monthly total returns, data through Sep 2026. Markdown version of this page: adx.md.