SV

Street Verdict

Analyst Scorecard

All indicators
Trend

ADX and DMI (Directional Movement)

Is there a real trend, or is the price just drifting?

+DI and −DI show whether buyers or sellers have pushed harder; ADX shows how strong the trend is, whichever way.

ADX / DMI on a chart of past prices

Stock
Period
Loading RELIANCE daily prices…

Settings: move a slider and the chart redraws

14

How many days the movement is averaged over.

25

The ADX level the rule treats as 'a real trend'.

What it measures

Each day the indicator asks: did the price push above yesterday's high (an up move) or below yesterday's low (a down move)? Only the bigger of the two counts as that day's directional movement.

+DI is the up movement of the last 14 days as a percentage of the stock's true range (its full daily swing, gaps included), and −DI is the same for the down movement. ADX then averages how far apart +DI and −DI are: a big gap, either way round, means a strong trend.

So ADX tells you how strong a trend is, not which way it goes. A stock in a steady decline has a high ADX too.

How traders read it

  • ADX above about 25: a trending market, where trend tools such as moving averages tend to whipsaw less. Below about 20: a sideways market.
  • +DI above −DI: buyers have had the upper hand. −DI above +DI: sellers have.
  • The classic entry, tested here, is +DI above −DI while ADX is above 25 (marked Buy on the chart); it exits when −DI takes over (Sell).
  • A rising ADX means the trend is getting stronger; a falling one, that it is fading.

The traps

ADX is not a direction

A high ADX in a falling market means a strong downtrend. Read it with +DI and −DI, never on its own.

Slow to react

ADX is smoothed twice, so it rises well after a trend has started and stays high after it ends.

25 is a convention

Nothing special happens at 25. Move the threshold slider and watch the signals change.

Test the classic rule: DMI crossover with an ADX filter

Would following the textbook signal have made money on this stock, after every cost, compared with just holding it? Run it and see.

Waiting for prices…

Quick check

Three questions on RELIANCE's own chart, with the classic settings. Get two right to mark ADX / DMI as done.

Waiting for prices…

Use it in a script

function run(bars, ta, helpers) {
  const d = ta.dmi(bars, 14, 6);   // .pdi = +DI, .mdi = -DI, .adx = ADX
  const signals = [];
  for (let i = 0; i < bars.length; i++) {
    if (d[i].pdi > d[i].mdi && d[i].adx > 25) signals.push(helpers.buy(i));  // buyers ahead, strong trend
    else if (d[i].pdi < d[i].mdi) signals.push(helpers.sell(i));                    // sellers ahead
  }
  return helpers.finalize(signals);
}

This is the rule tested above, with the settings on your sliders, and it gives exactly the same buy and sell candles. Paste it into the Scripts drawer of the chart workbench, or save it and compare it across stocks in the Strategy Lab. New to scripts? The Writing strategies track starts from zero.

In the reference:ta.dmi