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

Canonical URL: https://marketheist.io/portfolio/learn/adx
By Jeffrey Lin · Published 2026-11-23 · Updated 2026-11-24 · Data through Sep 2026
Category: Indicators

## 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**

```
\begin{pmatrix} u_t = H_t - H_{t - 1}, d_t = L_{t - 1} - L_t \\ + DM_t = {\begin{pmatrix} u_t & u_t > d_t and u_t > 0 \\ 0 & otherwise \end{pmatrix}, - DM_t = {\begin{pmatrix} d_t & d_t > u_t and d_t > 0 \\ 0 & otherwise \end{pmatrix} \end{pmatrix}
```

where:

- 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**

```
+ DI_t = 100 \frac{W ( + DM)_t}{W (TR)_t}, - DI_t = 100 \frac{W ( - DM)_t}{W (TR)_t}, DX_t = 100 \frac{| + DI_t - ( - DI_t)|}{+ DI_t + ( - DI_t)}, ADX_t = W (DX)_t
```

where:

- 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**

```
s_t = {\begin{pmatrix} 1 & ADX_t > \theta \\ 0 & otherwise \end{pmatrix}, r_{t + 1}^{rule} = s_t \cdot r_{t + 1}
```

where:

- θ: 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).

## How MarketHeist computes it

- **Data**: Daily 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.
- **Window**: The 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.
- **Backtest**: The 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 volatility**: A 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 statistics**: The 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 hold**: The 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. (`compute` in packages/shared/engine/indicators/adx.ts)
- **True range**: The largest of high − low, |high − previous close| and |low − previous close|, the same as in the ATR indicator; high − low on the first bar. (`compute` in packages/shared/engine/indicators/adx.ts)
- **Smoothing**: True 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. (`ewmMeanAlpha` in packages/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. (`compute` in packages/shared/engine/indicators/adx.ts)
- **What the rule reads**: ADX 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. (`SPEC` in packages/shared/engine/indicators/adx.ts)
- **Prices**: Daily 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. (`yahooResultToRows` in packages/platform/ohlcv.ts)
- **Timing, costs and cash**: The 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. (`runBacktest` in packages/shared/engine/backtest.ts)
- **Engine functions**: `computePosition` (packages/shared/engine/run_basic.ts), `generatePosition` (packages/shared/engine/positions.ts), `applyRegimeFilter` (packages/shared/engine/regime_filter.ts), `generateTriggeredPosition` (packages/shared/engine/triggered_position.ts), `runBacktest` (packages/shared/engine/backtest.ts), `getIndicator` (packages/shared/engine/indicators/registry.ts)

## Average directional index (ADX) compared with its neighbours

ADX and the indicators it is usually paired with

| Indicator | Answers | Direction | Typical use with ADX |
| --- | --- | --- | --- |
| ADX | How strong is the trend? | No | Filter: act only when a trend is present |
| +DI and −DI | Which side is pushing harder? | Yes | Direction: long when +DI is above −DI |
| Moving-average crossover | Is the price above its trend? | Yes | Direction signal, with ADX to skip sideways markets |
| ATR% | How much does the price move in a day? | No | Sizes stops; says nothing about trend |
| RSI | How stretched is the recent move? | Yes, as overbought or oversold | Mean 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

App: https://marketheist.io/backtest/?c=eyJ0aWNrZXIiOiJTUFkiLCJmcmVxdWVuY3kiOiIxZCIsImluZGljYXRvcl9pZCI6ImFkeCIsImluZGljYXRvcl9wYXJhbXMiOnsicGVyaW9kIjoxNH0sInBvc2l0aW9uX3J1bGUiOnsidHlwZSI6InRocmVzaG9sZCIsInRocmVzaG9sZCI6MjUsImRpcmVjdGlvbiI6ImFib3ZlIn0sImV4ZWN1dGlvbl9kZWxheSI6MSwidHJhbnNhY3Rpb25fY29zdHNfYnBzIjowLCJsZXZlcmFnZSI6eyJtb2RlIjoibm9uZSJ9fQ

MCP prompt (MarketHeist MCP server, https://marketheist.io/mcp):

```
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.
```

Historical simulation, not advice.
