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
| Input | Type | Default | Range or choices |
|---|---|---|---|
DI lengthlength | Whole number | 14 | min 2, max 5000 |
ADX smoothingsmooth | Whole number | 14 | min 1, max 5000 |
What it draws
| Line | Drawn as |
|---|---|
| ADX | Line |
| +DI | Line |
| -DI | Line |
Moves between 0 and 100. Guide lines at 25.
Used in
No strategy template reads it yet.