The ADX indicator, or Average Directional Index, is J. Welles Wilder's measure of trend strength, published with +DI and −DI in his 1978 book New Concepts in Technical Trading Systems. ADX smooths DX, which is 100 × |+DI − −DI| ÷ (+DI + −DI), on a 0–100 scale. A high ADX describes strong directional movement either up or down; ADX alone does not state the direction.

ADX and DMI at a glance
Scroll horizontally to read every column.
| Feature | Meaning |
|---|---|
| Measures | How strongly one direction of bar-to-bar movement dominates the other, relative to true range. |
| Components | +DI (upward directional movement), −DI (downward directional movement) and ADX (smoothed DX). |
| Direction | Comes from comparing +DI with −DI, not from ADX. |
| Smoothing | Wilder's smoothing, which weights each new value by 1/n. |
| Commonly cited levels | Wilder's 25 (strong trend) and 20 (weak or no trend) are conventions, not instructions. |
| Platforms | TradingView's ADX and DMI indicators; Pine Script v6's ta.dmi; MetaTrader 5's ADX and ADX Wilder. |
TradingView's DMI page credits Wilder and his 1978 book with the indicator.[1] TradingView's separate ADX indicator does not display the +DI and −DI lines; its DMI indicator shows all three.[3] The indicator rules library compares what each indicator measures. RSI, another Wilder indicator, measures smoothed gains against losses; ADX measures directional dominance.
How is ADX calculated from +DI and −DI?
Use one price series with high, low and close for each bar, and a positive integer period n. Every step compares the current bar with the previous bar.
- Directional movement: UpMove = high − previous high; DownMove = previous low − low.
- +DM and −DM: +DM = UpMove when UpMove is greater than DownMove and greater than zero; otherwise +DM = 0. −DM = DownMove when DownMove is greater than UpMove and greater than zero; otherwise −DM = 0.
- True range: TR = the largest of high − low, |high − previous close| and |low − previous close|.
- Directional indicators: smooth +DM, −DM and TR over n bars.
+DI = 100 × smoothed +DM ÷ smoothed TR; −DI = 100 × smoothed −DM ÷ smoothed TR
DX = 100 × |+DI − −DI| ÷ (+DI + −DI); ADX today = ((n − 1) × ADX yesterday + DX) ÷ n
StockCharts documents Wilder's steps: the first smoothed TR is the sum of the first n values, and each later value is prior − prior ÷ n + current. The first ADX is the average of the first n DX values.[2] A running sum seeded that way is exactly n times a Wilder average seeded with the simple mean. The ratio +DM ÷ TR is therefore identical under either form.
Because DX takes an absolute value, it has no sign. The directional movement definitions follow TradingView's DMI page, which uses strict inequalities.[1] When UpMove equals DownMove, both +DM and −DM are zero under that convention. An inside bar, with a lower high and a higher low, also gives zero for both.[2]
Worked example: directional movement, DI, DX and ADX
Illustrative numbers and period, not a recommendation. The previous bar has high 105, low 100 and close 103. The current bar has high 108, low 102 and close 107.
- Movement: UpMove = 108 − 105 = 3. DownMove = 100 − 102 = −2.
- Directional movement: UpMove is larger and positive, so +DM = 3 and −DM = 0.
- True range: the candidates are 108 − 102 = 6, |108 − 103| = 5 and |102 − 103| = 1, so TR = 6.
- Inside bar: if the next bar has high 106, low 103 and close 105, UpMove = −2 and DownMove = −1. Both DMs are zero. TR = 4, from |103 − 107|.
Now assume the smoothed values after enough bars are +DM 3.0, −DM 1.0 and TR 10.0. Then +DI = 100 × 3.0 ÷ 10.0 = 30 and −DI = 100 × 1.0 ÷ 10.0 = 10. DX = 100 × |30 − 10| ÷ (30 + 10) = 50.
With n = 5 and a previous ADX of 30, the next ADX = (4 × 30 + 50) ÷ 5 = 34. Swap the DI values to +DI 10 and −DI 30: DX is still 50, and ADX still rises to 34.

StockCharts notes that Wilder's smoothing needs a long history to settle: about 150 periods in its example. ADX from 30 bars of data will not match ADX from 150 bars.[2] Match the starting history before comparing two platforms.
What do ADX 25 and ADX 20 mean?
Wilder's commonly cited reference points are an ADX above 25 for a strong trend and below 20 for a weak or absent trend.[1][2] StockCharts calls the space between them a gray zone and says many analysts use 20 instead.[2]
Treat both numbers as conventions with caveats. TradingView's DMI page says suitable values depend on the instrument and warns against applying 25 and 20 everywhere.[1] StockCharts adds that ADX lags because of its smoothing.[2] No universal ADX threshold follows from the formula.
A falling ADX does not mean price is falling. ADX falls when neither DI line dominates as strongly as before, whichever direction price is moving.
How can ADX become a measurable condition?
ADX is most naturally a state: a filter that permits or blocks another rule. A DI crossing is an event. Keep the two separate when writing the rule.
- Regime filter (state): on the closed bar, ADX is above level L. The rule permits entries; it does not request one.
- Direction (state): +DI is above −DI, or −DI is above +DI. Equality needs its own stated outcome.
- DI crossing (event): previous +DI ≤ previous −DI and current +DI > current −DI.
- Rising strength (state): ADX is higher than it was k bars earlier. Name k and whether equality passes.
The crossing definition matches Pine's ta.crossover: the first series is greater on the current bar and was less than or equal on the previous bar.[5] The moving-average crossover rules apply the same two-bar test to averages.
Illustrative condition, not a recommended strategy: on a confirmed chart-bar close, raise an event when +DI crosses above −DI while ADX is above the chosen level. TradingView's DMI page and StockCharts describe Wilder's version of this combination, including stop placement at the signal bar's low.[1][2] That description is historical context, not evidence that the rule has an edge.
How do you use ta.dmi in Pine Script?
As of 25 September 2026, Pine Script v6 exposes ta.dmi(diLength, adxSmoothing), which returns a tuple of +DI, −DI and ADX.[4] The reference entry gives the signature and return values but no formula. Compare its output with a hand calculation on your own data before assuming a particular smoothing or seed.
Illustrative sketch; not compiled or tested. The input defaults are placeholders, not recommended settings.
//@version=6
indicator("DI cross with ADX filter")
diLen = input.int(14, "DI length", minval = 1)
adxLen = input.int(14, "ADX smoothing", minval = 1)
level = input.float(25.0, "ADX reference level")
[diPlus, diMinus, adx] = ta.dmi(diLen, adxLen)
diCross = ta.crossover(diPlus, diMinus)
event = barstate.isconfirmed and diCross and adx > level
plot(adx, "ADX")
plot(diPlus, "+DI")
plot(diMinus, "-DI")
alertcondition(event, "DI cross, ADX above level", "+DI crossed above -DI with ADX above level")
alertcondition() only makes the event selectable. You still create the running alert in TradingView, choose its frequency and the message. TradingView saves the script, inputs, symbol and timeframe with the alert, so recreate it after a change.[8] Values on an unfinished bar can change until the bar closes.[9] The crossing is computed on its own line because Pine v6 evaluates and lazily, and a skipped ta.crossover call would miss bars of history.[14]
Why can ADX differ between TradingView and MetaTrader 5?
MetaTrader 5 lists two indicators. Its standard Average Directional Movement Index help page documents a sum-based ADX formula.[6] Its separate ADX Wilder page says that indicator follows the algorithm in Wilder's book and uses smoothed moving averages.[7] The same name on two platforms can therefore produce different numbers from identical prices.
Different price data adds another difference. TradingView and MetaTrader can use different feeds, quotes and timestamps, as PineConnector's price-difference FAQ explains.[12] Decide which platform's ADX defines the rule, and do not expect the other to reproduce it exactly.
How does an ADX event become a PineConnector order request?
An ADX condition needs a separate action specification: direction, broker symbol, volume, exits and what happens on a repeat event. Test it on a demo account first, and choose your own symbol, size and rules. PineConnector's setup test separates message processing from the broker trade.[10] Follow the evidence stage by stage:
- Condition: the DI crossing and ADX filter are true on the closed bar.
- Alert: the TradingView alert triggers; check its log.
- Delivery: the webhook carries the message.
- Processing: find the matching entry in PineConnector Portal → Bridge.
- EA request: confirm whether an order request was submitted.
- Broker outcome: check acceptance, the resulting deal or deals and the position.
MetaQuotes defines orders, deals and positions separately.[11] Wilder's stop at the signal bar's low exists only as a rule until you send it as a broker-side stop loss. An ADX exit evaluated in TradingView is a strategy-side exit, not a broker order.
Which ADX mistakes change the rule?
- Reading ADX as direction. A rising ADX during a decline describes a stronger decline.
- Using too little history. Wilder's smoothing depends on its starting state; short histories give different values.[2]
- Tuning the level after seeing results. Adjusting the DI length, ADX smoothing and threshold on the same history adds fitted choices. TradingView documents overfitting and separate out-of-sample testing.[13]
- Acting on an unfinished crossing. DI lines can cross and uncross before the bar closes.
- Assuming platform equivalence. MT5's two ADX variants document different calculations.[6][7]
A precise ADX rule establishes what the rule means. It does not establish that the rule has positive expectancy.
Frequently asked questions
What does the ADX indicator measure?
The Average Directional Index measures trend strength, not trend direction. Wilder derived it by smoothing DX, which compares the absolute gap between +DI and −DI with their sum. A high ADX means one direction of movement dominates strongly. Whether that direction is up or down comes from comparing +DI with −DI.
What is the difference between ADX and DMI?
DMI, the Directional Movement Index, is Wilder's full set of three lines: +DI, −DI and ADX. The two DI lines describe upward and downward directional movement relative to true range. ADX is the smoothed strength line derived from them. On TradingView, the ADX indicator shows only ADX, while the DMI indicator shows all three lines.
Is ADX above 25 a strong trend?
Wilder's commonly cited convention treats ADX above 25 as a strong trend and below 20 as weak or absent. Many analysts use 20 as the key level instead. TradingView's DMI documentation says suitable values depend on the instrument. No universal ADX threshold exists, and a level alone does not define a trade.
How does ta.dmi work in Pine Script?
In Pine Script v6, ta.dmi(diLength, adxSmoothing) returns a tuple of three series: +DI, −DI and ADX. The first argument sets the DI period and the second sets ADX smoothing. The reference does not publish the internal formula, so compare results with a hand calculation. Computing ta.dmi alone creates no alert and no order.
Reviewed 25 September 2026. Facts were checked against the linked sources on that date. Nothing in this article was tested on a trading account and no code was compiled.
Related reading
- Indicator rules library
- RSI indicator: formula, crossings and divergence rules
- Moving-average crossover rules
- Stochastic oscillator: %K, %D and crossing rules
- ta.crossover and ta.crossunder in Pine Script
Sources
- TradingView – Directional Movement (DMI), accessed 25 September 2026.
- StockCharts ChartSchool – Average Directional Index (ADX), accessed 25 September 2026.
- TradingView – Average Directional Index (ADX), accessed 25 September 2026.
- TradingView – Pine Script v6 reference: ta.dmi, accessed 25 September 2026.
- TradingView – Pine Script v6 reference: ta.crossover, accessed 25 September 2026.
- MetaQuotes – Average Directional Movement Index, accessed 25 September 2026.
- MetaQuotes – Average Directional Movement Index Wilder, accessed 25 September 2026.
- TradingView – Alerts, accessed 25 September 2026.
- TradingView – Repainting, accessed 25 September 2026.
- PineConnector – Test your setup, accessed 25 September 2026.
- MetaQuotes – Basic principles: orders, deals and positions, accessed 25 September 2026.
- PineConnector – Frequently asked questions: price differences, accessed 25 September 2026.
- TradingView – Strategies: overfitting, accessed 25 September 2026.
- TradingView – Migrating to Pine Script v6: lazy evaluation of conditions, accessed 25 September 2026.
PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.