Direct answer: what a worked example of ADX looks like
A worked example of ADX takes assumed price data (typically OHLC), computes the directional movement components (+DM and −DM) and the true range (TR), then applies a smoothing step to produce directional indicator values (+DI and −DI). Finally, it combines those values into ADX, which is intended to measure trend strength rather than direction.
Because no live prices or provider-specific settings are assumed here, the example is fully numerical and states every assumption, so you can independently verify each step.
Mechanism or definition: what ADX is calculating
ADX is commonly presented through these parts:
- Directional movement over each step (often “one period”):
- +DM is based on upward movement; −DM is based on downward movement.
- One is set to zero when the other dominates in that step.
- True range (TR):
- TR accounts for intraday range and gaps. With OHLC, TR is computed from the current high/low and the prior close.
- Smoothed averages:
- The +DM and −DM values are converted into smoothed directional movement sums.
- TR is also smoothed.
- Directional indicator values:
- +DI is proportional to smoothed +DM divided by smoothed TR.
- −DI is proportional to smoothed −DM divided by smoothed TR.
- ADX:
- The “directional difference” uses +DI and −DI.
- ADX is based on the smoothed average of the chosen directional difference, so it reflects strength over time.
Important: exact formula details can vary by source (for example, how smoothing is initialized). The worked example below uses a simple, explicit smoothing approach so the arithmetic is checkable.
Evidence or example: a transparent numerical ADX calculation
Assumptions
- Period length N = 3.
- We use consecutive periods with OHLC-like inputs.
- Smoothing method: for this worked example, we use a simple running average for demonstration (not a particular platform’s production-grade smoothing). This assumption is a key variable you must match when verifying.
- We start computing after enough data exists to form the first smoothed values.
Assumed data (three intervals)
Let each interval t have High (H), Low (L), and Close (C). Prior close is the previous period’s close.
Period 0 (prior reference):
- H0=1.1050, L0=1.1000, C0=1.1020
Period 1:
- H1=1.1080, L1=1.1040, C1=1.1060
Period 2:
- H2=1.1090, L2=1.1050, C2=1.1070
Period 3:
- H3=1.1100, L3=1.1060, C3=1.1080
Step A: compute TR for each interval
For each period t=1..3, assume TR is:
- TRt = max(Ht − Lt, |Ht − C(t−1)|, |Lt − C(t−1)|)
Interval 1:
- H1−L1 = 1.1080−1.1040 = 0.0040
- |H1−C0| = |1.1080−1.1020| = 0.0060
- |L1−C0| = |1.1040−1.1020| = 0.0020
- TR1 = max(0.0040, 0.0060, 0.0020) = 0.0060
Interval 2:
- H2−L2 = 1.1090−1.1050 = 0.0040
- |H2−C1| = |1.1090−1.1060| = 0.0030
- |L2−C1| = |1.1050−1.1060| = 0.0010
- TR2 = max(0.0040, 0.0030, 0.0010) = 0.0040
Interval 3:
- H3−L3 = 1.1100−1.1060 = 0.0040
- |H3−C2| = |1.1100−1.1070| = 0.0030
- |L3−C2| = |1.1060−1.1070| = 0.0010
- TR3 = max(0.0040, 0.0030, 0.0010) = 0.0040
Step B: compute +DM and −DM for each interval
Assume the directional movement increments are based on changes in highs/lows:
- UpMove = Ht − H(t−1)
- DownMove = L(t−1) − Lt
- +DMt = UpMove if UpMove > DownMove and UpMove > 0, else 0
- −DMt = DownMove if DownMove > UpMove and DownMove > 0, else 0
Interval 1:
- UpMove = H1−H0 = 1.1080−1.1050 = 0.0030
- DownMove = L0−L1 = 1.1000−1.1040 = −0.0040
- Since DownMove is not > 0, +DM1 = 0.0030, −DM1 = 0
Interval 2:
- UpMove = H2−H1 = 1.1090−1.1080 = 0.0010
- DownMove = L1−L2 = 1.1040−1.1050 = −0.0010
- +DM2 = 0.0010, −DM2 = 0
Interval 3:
- UpMove = H3−H2 = 1.1100−1.1090 = 0.0010
- DownMove = L2−L3 = 1.1050−1.1060 = −0.0010
- +DM3 = 0.0010, −DM3 = 0
Step C: smooth averages (explicit assumption)
With N=3 and a simple average for demonstration:
- Smoothed TR at t=3: avg(TR1. . TR3) = (0. 0060+0. 0040+0. 0040)/3 = 0. 0140/3 ≈ 0.