ADX formula: how to calculate ADX, +DI and −DI (with Excel)
How the Average Directional Index is worked out — directional movement, +DI and −DI, DX and Wilder's 14-period ADX, column by column. With a worked example, the Excel formulas, a free Excel sheet and a box to calculate ADX from your own high, low and close.
Last updated:
Needs: high, low, close · Standard settings: Period 14
The ADX formula
Up-move = High − previous High
Down-move = previous Low − Low
+DM = Up-move, if Up-move > Down-move and Up-move > 0 (otherwise 0)
−DM = Down-move, if Down-move > Up-move and Down-move > 0 (otherwise 0)
TR = true range (see the ATR formula)
TR (14), +DM (14), −DM (14):
first value = sum of the first 14 values
next value = previous − previous ÷ 14 + current value
+DI = 100 × +DM (14) ÷ TR (14)
−DI = 100 × −DM (14) ÷ TR (14)
DX = 100 × |+DI − −DI| ÷ (+DI + −DI)
ADX = average of the first 14 DX values, then
(previous ADX × 13 + DX) ÷ 14This is Wilder's original method from 1978. Smoothing with running sums or with averages gives the same +DI and −DI, because both the top and the bottom of each fraction change in the same way. The true range is worked out as on the ATR formula page.
How to calculate ADX step by step
- Work out the true range, +DM and −DM from the second candle. Day 2: the high fell (up-move 1,004.60 − 1,010.00 is below zero) and the low fell by 2.85, so +DM = 0.00, −DM = 2.85 and the true range is 16.85.
- Add up the first 14 of each. Day 2 to Day 15 gives, on Day 15: TR (14) 302.35, +DM (14) 99.00, −DM (14) 29.55.
- Turn them into +DI, −DI and DX. +DI = 100 × 99.00 ÷ 302.35 = 32.74; −DI = 100 × 29.55 ÷ 302.35 = 9.77; DX = 100 × |32.74 − 9.77| ÷ (32.74 + 9.77) = 54.03.
- Smooth the three totals from the next candle on. Day 16: TR (14) = 302.35 − 302.35 ÷ 14 + 41.45 = 322.20, and the same for +DM and −DM.
- Average DX for ADX. The first ADX, on Day 28, is the average of the 14 DX values from Day 15 to Day 28: 27.06. Day 29: (27.06 × 13 + 52.31) ÷ 14 = 28.86.
- Repeat for every candle. On Day 60 the example's ADX is 28.68, +DI 38.55 and −DI 15.06.
Worked example — and calculate ADX from your own prices
The table works through 60 daily candles of an imaginary stock, column by column — the same columns as the Excel sheet. To calculate ADX for your own stock, clear the box and paste your high, low, close from Excel or your broker's download.
Latest values
| Day | High | Low | Close | True range | +DM | −DM | TR (14) | +DM (14) | −DM (14) | +DI | −DI | DX | ADX (14) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Day 1 | 1,010.00 | 990.60 | 1,001.15 | ||||||||||
| Day 2 | 1,004.60 | 987.75 | 987.95 | 16.85 | 0.00 | 2.85 | |||||||
| Day 3 | 1,011.50 | 986.00 | 1,009.15 | 25.50 | 6.90 | 0.00 | |||||||
| Day 4 | 1,015.00 | 1,001.85 | 1,012.60 | 13.15 | 3.50 | 0.00 | |||||||
| Day 5 | 1,012.00 | 990.80 | 993.25 | 21.80 | 0.00 | 11.05 | |||||||
| Day 6 | 1,012.60 | 990.90 | 1,008.60 | 21.70 | 0.60 | 0.00 | |||||||
| Day 7 | 1,018.95 | 1,003.80 | 1,013.60 | 15.15 | 6.35 | 0.00 | |||||||
| Day 8 | 1,012.95 | 994.75 | 1,001.55 | 18.85 | 0.00 | 9.05 | |||||||
| Day 9 | 1,033.25 | 995.30 | 1,031.55 | 37.95 | 20.30 | 0.00 | |||||||
| Day 10 | 1,046.15 | 1,028.50 | 1,040.05 | 17.65 | 12.90 | 0.00 | |||||||
| Day 11 | 1,041.80 | 1,027.70 | 1,033.15 | 14.10 | 0.00 | 0.80 | |||||||
| Day 12 | 1,065.80 | 1,031.15 | 1,064.80 | 34.65 | 24.00 | 0.00 | |||||||
| Day 13 | 1,086.00 | 1,056.85 | 1,083.55 | 29.15 | 20.20 | 0.00 | |||||||
| Day 14 | 1,090.25 | 1,067.25 | 1,067.95 | 23.00 | 4.25 | 0.00 | |||||||
| Day 15 | 1,074.30 | 1,061.45 | 1,063.50 | 12.85 | 0.00 | 5.80 | 302.3500 | 99.0000 | 29.5500 | 32.7435 | 9.7734 | 54.0257 | |
| Day 16 | 1,067.35 | 1,025.90 | 1,030.20 | 41.45 | 0.00 | 35.55 | 322.2036 | 91.9286 | 62.9893 | 28.5312 | 19.5495 | 18.6804 | |
| Day 17 | 1,033.00 | 1,011.75 | 1,012.20 | 21.25 | 0.00 | 14.15 | 320.4390 | 85.3622 | 72.6401 | 26.6392 | 22.6689 | 8.0519 | |
| Day 18 | 1,019.90 | 979.85 | 981.60 | 40.05 | 0.00 | 31.90 | 337.6005 | 79.2649 | 99.3515 | 23.4789 | 29.4287 | 11.2456 | |
| Day 19 | 988.30 | 969.40 | 970.55 | 18.90 | 0.00 | 10.45 | 332.3862 | 73.6032 | 102.7049 | 22.1439 | 30.8993 | 16.5062 | |
| Day 20 | 973.10 | 959.05 | 960.90 | 14.05 | 0.00 | 10.35 | 322.6943 | 68.3458 | 105.7189 | 21.1797 | 32.7613 | 21.4708 | |
| Day 21 | 980.35 | 958.30 | 978.30 | 22.05 | 7.25 | 0.00 | 321.6947 | 70.7139 | 98.1675 | 21.9817 | 30.5157 | 16.2561 | |
| Day 22 | 981.50 | 957.00 | 958.85 | 24.50 | 0.00 | 1.30 | 323.2165 | 65.6630 | 92.4556 | 20.3155 | 28.6048 | 16.9446 | |
| Day 23 | 963.00 | 942.60 | 946.75 | 20.40 | 0.00 | 14.40 | 320.5296 | 60.9727 | 100.2516 | 19.0225 | 31.2769 | 24.3629 | |
| Day 24 | 957.70 | 931.65 | 937.95 | 26.05 | 0.00 | 10.95 | 323.6847 | 56.6175 | 104.0408 | 17.4916 | 32.1426 | 29.5181 | |
| Day 25 | 945.75 | 926.05 | 927.85 | 19.70 | 0.00 | 5.60 | 320.2643 | 52.5734 | 102.2093 | 16.4156 | 31.9140 | 32.0681 | |
| Day 26 | 924.60 | 910.25 | 911.20 | 17.60 | 0.00 | 15.80 | 314.9883 | 48.8182 | 110.7086 | 15.4984 | 35.1469 | 38.7963 | |
| Day 27 | 919.05 | 900.00 | 905.15 | 19.05 | 0.00 | 10.25 | 311.5391 | 45.3312 | 113.0509 | 14.5507 | 36.2879 | 42.7572 | |
| Day 28 | 904.50 | 884.70 | 885.95 | 20.45 | 0.00 | 15.30 | 309.7364 | 42.0932 | 120.2758 | 13.5900 | 38.8317 | 48.1512 | 27.0596 |
| Day 29 | 891.25 | 871.55 | 874.70 | 19.70 | 0.00 | 13.15 | 307.3123 | 39.0866 | 124.8347 | 12.7188 | 40.6214 | 52.3105 | 28.8633 |
| Day 30 | 880.70 | 849.70 | 855.80 | 31.00 | 0.00 | 21.85 | 316.3614 | 36.2947 | 137.7679 | 11.4725 | 43.5476 | 58.2970 | 30.9657 |
| Day 31 | 868.95 | 858.15 | 862.15 | 13.15 | 0.00 | 0.00 | 306.9142 | 33.7022 | 127.9273 | 10.9810 | 41.6818 | 58.2970 | 32.9179 |
| Day 32 | 875.05 | 859.50 | 866.45 | 15.55 | 6.10 | 0.00 | 300.5418 | 37.3949 | 118.7897 | 12.4425 | 39.5252 | 52.1145 | 34.2891 |
| Day 33 | 870.55 | 843.00 | 845.10 | 27.55 | 0.00 | 16.50 | 306.6245 | 34.7238 | 126.8047 | 11.3245 | 41.3550 | 57.0059 | 35.9117 |
| Day 34 | 854.70 | 846.55 | 851.55 | 9.60 | 0.00 | 0.00 | 294.3227 | 32.2436 | 117.7472 | 10.9552 | 40.0062 | 57.0059 | 37.4185 |
| Day 35 | 863.70 | 847.85 | 860.20 | 15.85 | 9.00 | 0.00 | 289.1497 | 38.9405 | 109.3367 | 13.4672 | 37.8132 | 47.4761 | 38.1369 |
| Day 36 | 862.95 | 845.40 | 854.80 | 17.55 | 0.00 | 2.45 | 286.0461 | 36.1590 | 103.9769 | 12.6410 | 36.3497 | 48.3944 | 38.8695 |
| Day 37 | 882.25 | 858.05 | 877.20 | 27.45 | 19.30 | 0.00 | 293.0643 | 52.8762 | 96.5500 | 18.0425 | 32.9450 | 29.2277 | 38.1808 |
| Day 38 | 893.65 | 868.85 | 888.45 | 24.80 | 11.40 | 0.00 | 296.9311 | 60.4993 | 89.6536 | 20.3749 | 30.1934 | 19.4164 | 36.8405 |
| Day 39 | 908.35 | 889.60 | 905.40 | 19.90 | 14.70 | 0.00 | 295.6217 | 70.8780 | 83.2498 | 23.9759 | 28.1609 | 8.0270 | 34.7824 |
| Day 40 | 913.10 | 895.65 | 896.80 | 17.45 | 4.75 | 0.00 | 291.9559 | 70.5652 | 77.3033 | 24.1698 | 26.4777 | 4.5568 | 32.6234 |
| Day 41 | 894.65 | 887.85 | 889.60 | 8.95 | 0.00 | 7.80 | 280.0519 | 65.5249 | 79.5817 | 23.3974 | 28.4168 | 9.6872 | 30.9851 |
| Day 42 | 898.55 | 884.80 | 895.30 | 13.75 | 3.90 | 0.00 | 273.7982 | 64.7445 | 73.8973 | 23.6468 | 26.9897 | 6.6017 | 29.2435 |
| Day 43 | 920.60 | 889.25 | 919.00 | 31.35 | 22.05 | 0.00 | 285.5912 | 82.1699 | 68.6189 | 28.7719 | 24.0270 | 8.9868 | 27.7966 |
| Day 44 | 920.60 | 916.30 | 918.35 | 4.30 | 0.00 | 0.00 | 269.4918 | 76.3006 | 63.7175 | 28.3128 | 23.6436 | 8.9868 | 26.4530 |
| Day 45 | 919.30 | 903.80 | 906.25 | 15.50 | 0.00 | 12.50 | 265.7424 | 70.8506 | 71.6663 | 26.6614 | 26.9683 | 0.5724 | 24.6044 |
| Day 46 | 937.35 | 900.30 | 932.10 | 37.05 | 18.05 | 0.00 | 283.8108 | 83.8398 | 66.5473 | 29.5407 | 23.4478 | 11.4987 | 23.6683 |
| Day 47 | 947.15 | 930.20 | 944.35 | 16.95 | 9.80 | 0.00 | 280.4886 | 87.6513 | 61.7939 | 31.2495 | 22.0308 | 17.3022 | 23.2135 |
| Day 48 | 949.20 | 937.25 | 948.70 | 11.95 | 2.05 | 0.00 | 272.4037 | 83.4405 | 57.3800 | 30.6312 | 21.0643 | 18.5061 | 22.8773 |
| Day 49 | 971.15 | 949.05 | 966.35 | 22.45 | 21.95 | 0.00 | 275.3963 | 99.4304 | 53.2815 | 36.1045 | 19.3472 | 30.2196 | 23.4018 |
| Day 50 | 965.90 | 954.75 | 955.60 | 11.60 | 0.00 | 0.00 | 267.3251 | 92.3283 | 49.4757 | 34.5378 | 18.5077 | 30.2196 | 23.8887 |
| Day 51 | 971.35 | 954.15 | 969.10 | 17.20 | 5.45 | 0.00 | 265.4305 | 91.1834 | 45.9417 | 34.3530 | 17.3084 | 32.9930 | 24.5391 |
| Day 52 | 997.00 | 966.55 | 984.35 | 30.45 | 25.65 | 0.00 | 276.9212 | 110.3203 | 42.6601 | 39.8382 | 15.4052 | 44.2280 | 25.9454 |
| Day 53 | 992.30 | 980.25 | 980.90 | 12.05 | 0.00 | 0.00 | 269.1911 | 102.4403 | 39.6130 | 38.0549 | 14.7156 | 44.2280 | 27.2513 |
| Day 54 | 984.70 | 961.40 | 962.50 | 23.30 | 0.00 | 18.85 | 273.2631 | 95.1231 | 55.6335 | 34.8101 | 20.3589 | 26.1943 | 27.1758 |
| Day 55 | 964.60 | 953.00 | 960.20 | 11.60 | 0.00 | 8.40 | 265.3443 | 88.3286 | 60.0597 | 33.2883 | 22.6346 | 19.0507 | 26.5954 |
| Day 56 | 969.05 | 954.50 | 967.35 | 14.55 | 4.45 | 0.00 | 260.9412 | 86.4694 | 55.7697 | 33.1375 | 21.3725 | 21.5832 | 26.2374 |
| Day 57 | 982.20 | 960.60 | 971.00 | 21.60 | 13.15 | 0.00 | 263.9025 | 93.4430 | 51.7861 | 35.4082 | 19.6232 | 28.6836 | 26.4121 |
| Day 58 | 987.10 | 967.55 | 981.75 | 19.55 | 4.90 | 0.00 | 264.6023 | 91.6685 | 48.0871 | 34.6439 | 18.1734 | 31.1840 | 26.7530 |
| Day 59 | 999.95 | 979.00 | 994.85 | 20.95 | 12.85 | 0.00 | 266.6522 | 97.9708 | 44.6523 | 36.7410 | 16.7455 | 37.3842 | 27.5124 |
| Day 60 | 1,015.15 | 987.35 | 1,012.35 | 27.80 | 15.20 | 0.00 | 275.4056 | 106.1729 | 41.4629 | 38.5515 | 15.0552 | 43.8308 | 28.6780 |
The example prices are made up for this page — they are not real market data. ADX is a calculation from past prices, not a forecast, a signal or advice to buy or sell. MyAlgoMate provides trading technology, not investment advice.
How to calculate ADX in Excel
Put the headings in row 1 and the first candle in row 2, oldest at the top. Then type these formulas — each column uses the ones to its left:
- A
Day
A2 downwards: your dates, oldest at the top.
- B
High
B2 downwards: the high prices, oldest at the top.
- C
Low
C2 downwards: the low prices, oldest at the top.
- D
Close
D2 downwards: the closing prices, oldest at the top.
- E
True range
E3
=MAX(B3-C3,ABS(B3-D2),ABS(C3-D2))— then copy it down to the last row. - F
+DM
F3
=IF(AND(B3-B2>C2-C3,B3-B2>0),B3-B2,0)— then copy it down to the last row. - G
-DM
G3
=IF(AND(C2-C3>B3-B2,C2-C3>0),C2-C3,0)— then copy it down to the last row. - H
TR (14)
H16
=SUM(E3:E16)— this cell only (the starting value).H17
=H16-H16/14+E17— then copy it down to the last row. - I
+DM (14)
I16
=SUM(F3:F16)— this cell only (the starting value).I17
=I16-I16/14+F17— then copy it down to the last row. - J
-DM (14)
J16
=SUM(G3:G16)— this cell only (the starting value).J17
=J16-J16/14+G17— then copy it down to the last row. - K
+DI
K16
=100*I16/H16— then copy it down to the last row. - L
-DI
L16
=100*J16/H16— then copy it down to the last row. - M
DX
M16
=IF(K16+L16=0,0,100*ABS(K16-L16)/(K16+L16))— then copy it down to the last row. - N
ADX (14)
N29
=AVERAGE(M16:M29)— this cell only (the starting value).N30
=(N29*13+M30)/14— then copy it down to the last row.
Row 2 (the first candle) has no previous high or low, so the calculation starts in row 3; ADX starts in row 29.
Prefer not to type them? The free sheet has every formula filled in for the example prices — replace the prices with yours and extend the rows. It opens in Microsoft Excel (we checked every value against the table above), and you can import it into Google Sheets or LibreOffice.
Download the free ADX Excel sheet (.xlsx)What the lines show
+DI and −DI compare the size of recent up-moves and down-moves with the true range. DX and ADX measure how far apart +DI and −DI are — so ADX says how one-sided recent movement has been, not which side. Many charts draw a reference line at 20 or 25. All of it is calculated from past prices; it is not a forecast or advice.
ADX calculation — questions, answered.
Work out +DM, −DM and the true range for each candle; smooth each over 14 candles with Wilder's method; divide to get +DI and −DI; turn their gap into DX = 100 × |+DI − −DI| ÷ (+DI + −DI); and finally ADX = the 14-period Wilder average of DX.
High, low and close in columns B, C and D from row 2. From row 3: true range, +DM and −DM (formulas on this page). In row 16, SUM the first 14 of each; from row 17, previous − previous ÷ 14 + current. +DI and −DI = 100 × the smoothed DM ÷ the smoothed true range, then DX. ADX in row 29 = AVERAGE of the first 14 DX values, then (previous × 13 + DX) ÷ 14. The free sheet has every formula filled in.
Up-move = High − previous High; down-move = previous Low − Low. +DM is the up-move if it is larger than the down-move and above zero, otherwise 0. −DM is the down-move if it is larger than the up-move and above zero, otherwise 0. So on any candle at most one of them is above zero.
Directional movement starts on the 2nd candle, the 14-candle sums are ready on the 15th, and ADX is a 14-period average of DX, so the first ADX (14) appears on the 28th candle. Because of the smoothing, use many more candles than that if you want to match a chart.
DMI (the Directional Movement Index) is the set of +DI and −DI lines. DX measures how far apart they are on a 0–100 scale. ADX is the smoothed average of DX. Many charts show all three lines in one 'ADX/DMI' indicator.
Mostly the starting point: ADX is smoothed twice, so it takes a long history to settle — start from 150 or more candles. Some charts let you set a different smoothing length for ADX and for the DI lines. Spot vs futures prices and the timeframe matter too.
More indicator formulas, with Excel sheets
Turn your own rules into automated orders.
Already use ADX in your own rules? MyAlgoMate's algo trading software places the orders your rules call for at 150+ Indian brokers — and TradeBridge turns your own TradingView or Chartink alerts into live orders. You decide the rules; we provide the technology.