How is ADX calculated?

Learn how ADX is calculated using the core formulas and inputs.

Direct answer: the ADX calculation in one chain

ADX (Average Directional Index) is built in layers from price changes: (1) compute directional movement and true range for each period, (2) smooth those series, (3) compute directional indicators (+DI and −DI), (4) compute DX from their relationship, and (5) smooth DX to get ADX.

A common, standard definition uses a lookback length often written as n (frequently 14, but the method supports other values). ADX values depend on the chosen n and on the smoothing rule used by the implementation.

Mechanism: definitions and step-by-step formulas

To describe the calculation without assuming live data, assume you have a sequence of candles/bars ordered by time. For each bar t, you need its high, low, and close (or at least high/low/close as defined below).

1) Compute True Range (TR)

True Range captures the magnitude of movement, including gaps. For bar t relative to t−1:

  • TR(t) = max( High(t) − Low(t), |High(t) − Close(t−1)|, |Low(t) − Close(t−1)| )

This definition makes TR larger when the current range is wide or when price gaps across the prior close.

2) Compute directional movement: +DM and −DM

Directional movement separates upward moves from downward moves:

  • UpMove(t) = High(t) − High(t−1)
  • DownMove(t) = Low(t−1) − Low(t)

A typical rule is:

  • +DM(t) = UpMove(t) if UpMove(t) > DownMove(t) and UpMove(t) > 0, else 0
  • −DM(t) = DownMove(t) if DownMove(t) > UpMove(t) and DownMove(t) > 0, else 0

This “either/or” structure ensures only the dominant direction contributes at each step.

3) Smooth TR, +DM, and −DM

ADX is not computed from raw TR and DM each bar; it uses a smoothing step. Many implementations use Wilder-style smoothing (a common approach), which is equivalent to a particular recursive moving average.

Let SmoothedTR(t) be the smoothed TR and similarly Smoothed+DM(t) and Smoothed−DM(t).

With Wilder-style smoothing for period n, the recursion typically looks like:

  • SmoothedTR(t) = SmoothedTR(t−1) − (SmoothedTR(t−1) / n) + TR(t)
  • Smoothed+DM(t) = Smoothed+DM(t−1) − (Smoothed+DM(t−1) / n) + +DM(t)
  • Smoothed−DM(t) = Smoothed−DM(t−1) − (Smoothed−DM(t−1) / n) + −DM(t)

Initialization matters: implementations usually start the smoothed series after enough bars to establish an initial sum or average over n periods.

4) Compute +DI and −DI

Directional indicators convert the smoothed directional movement into values relative to smoothed TR:

  • +DI(t) = 100 × Smoothed+DM(t) / SmoothedTR(t)
  • −DI(t) = 100 × Smoothed−DM(t) / SmoothedTR(t)

5) Compute DX (Directional Index)

DX describes how strongly one direction dominates the other:

  • DX(t) = 100 × |+DI(t) − −DI(t)| / (+DI(t) + −DI(t))

If +DI(t) + −DI(t) is zero (possible with flat or no-direction movement and certain data/start conditions), an implementation must handle division by zero.

6) Smooth DX to get ADX

Finally, ADX is a smoothed moving average of DX over period n (again, commonly Wilder-style):

  • ADX(t) = smoothed average of DX(t) over the chosen length n

In practice, the first ADX value is produced after a warm-up region (often after accumulating enough DX points). Different platforms may choose slightly different initialization conventions, which leads to small discrepancies.

Evidence via a small worked example (with explicit assumptions)

Without real-time data, a full numeric example would be arbitrary. Instead, here is a compact calculation template you can apply to your own OHLC bars.

Assume you have consecutive bars and you select a period n. For each bar starting at the second bar (because t−1 is required):

  1. Compute TR(t) from High(t), Low(t), and Close(t−1).
  2. Compute +DM(t) and −DM(t) from differences in highs and lows.
  3. Build smoothed values SmoothedTR(t), Smoothed+DM(t), Smoothed−DM(t) using the chosen smoothing rule and correct initialization.
  4. Compute +DI(t) and −DI(t).
  5. Compute DX(t).
  6. Smooth DX(t) to form ADX(t).

Material assumption to state when you verify independently: your data source (which OHLC values exactly), your chosen n, and your smoothing rule must match the implementation you are checking. Even if the formulas are “standard,” the warm-up and smoothing details can differ.

If you want to confirm that two systems compute the same ADX, export the same OHLC series, apply the same n, use the same TR/DM definitions, and verify intermediate series (+DM/−DM, +DI/−DI, DX) before comparing the final ADX.

Limitations and failure modes you should account for

ADX is often described as a “trend strength” measure, but that interpretation has limits. The main issues come from data sensitivity and from how directional movement behaves.

1) ADX depends on smoothing and initialization

Because ADX uses smoothed TR/DM and smoothed DX, results can vary when:

  • you change n,
  • you change the smoothing method (or initialization convention), or
  • your platform handles edge cases differently (e.g., early bars, division by zero).

This is a key failure mode when comparing numbers across providers.

2) High values do not guarantee directional advantage

ADX is computed from the magnitude of directional dominance, not from a guaranteed direction. It can be relatively elevated when one direction consistently dominates even if the broader environment later changes.

This matters because a later shift in directional movement can make prior ADX behavior less informative.

3) Choppy or range-bound markets can produce misleading strength readings

Directional movement definitions can still create repeated dominance in small, irregular moves. In some “sideways but volatile” conditions, ADX may rise even though there is no sustained, stable trend structure.

That means ADX is best treated as an indicator of movement characteristics, not as a standalone decision rule.

Verification: how to independently check your ADX calculation

To verify ADX for yourself using the formula chain above:

  1. Choose a specific n and record it.
  2. Use one consistent OHLC dataset and confirm that you have High, Low, Close aligned by time.
  3. Compute TR, +DM, and −DM exactly with the same conditional logic.
  4. Apply the same smoothing rule and initialization used by your reference.
  5. Compute +DI, −DI, DX, then smooth DX into ADX.
  6. Compare intermediate outputs first; if those match, the final ADX is very likely consistent.
Trading foreign exchange and CFDs involves substantial risk. Information on FoxiForex is educational and is not personal financial advice. Sponsored placements are labelled clearly.