Directional movement index
All indicators

LibraryTrend

Indicator

Directional movement index

Welles Wilder's directional movement: +DI and -DI show which side moves more, the ADX how strong the trend is, whatever its direction.

TrendOwn pane2 inputsDMI

How it is calculated

+DM is the rise of the high when it beats the fall of the low, -DM the reverse, else 0. DM and true range are Wilder sums: the first length minus 1 added up, then S minus S / length plus the new value. The DIs are 100 times DM / TR, DX is 100 times |+DI minus -DI| / (+DI plus -DI), the ADX the mean of the first smooth DX values, then Wilder's average. All start on bar length + smooth minus 1; with smooth equal to length this is TA-Lib's ADX.

Reference: TA-Lib ADX, PLUS_DI, MINUS_DI (Wilder 1978)

How to read it

An ADX above 25 is usually read as a trending market, below 20 as a range; a rising ADX means the trend gets stronger, not that price rises. +DI above -DI points up, below points down. Without an ADX filter the DI crosses give many false signals.

In a strategy

Trade +DI over -DI only while the trend is strong: ctx.ind("dmi", length=14, smooth=14).adx above 25 and .plus above .minus.

Inputs

InputTypeDefaultRange or choices
DI lengthlengthWhole number14min 2, max 5000
ADX smoothingsmoothWhole number14min 1, max 5000

What it draws

LineDrawn as
ADXLine
+DILine
-DILine

Moves between 0 and 100. Guide lines at 25.

Used in

No strategy template reads it yet.

OrionQuant