The Directional Movement Index (DMI) comprises three plots: DI+, DI-, and ADX (Average Directional Index). DI+ is calculated as an average increase of high price (if the high price decreases, 0 is taken), divided by the ATR (Average True Range) and multiplied by 100. DI- is calculated similarly, using the decrease of low price instead. By default, in the calculation of both DI+ and DI-, the Wilder's average is used, however, you are free to choose other average types in input parameters. ADX is calculated as an average of the directional index; the average type is the same as in DI+ and DI. The directional index, in turn, is equal to the percentage ratio of the absolute value of difference between DI+ and DI- to their sum.

DMI is a trend-following indicator. DI+ crossing above the DI- suggests uptrend conditions, and vice versa, DI+ crossing below the DI- might signify the downtrend. ADX is used for confirmation: trend indications are more likely to be correct if ADX is rising and its values are above 50.

Input Parameters

Parameter Description
length The number of bars used to calculate DI+, DI-, and ADX.
average type The type of moving average to be used in calculations: simple, exponential, weighted, Wilder's, or Hull.


Plot Description
DI+ The Plus Directional Indicator.
DI- The Minus Directional Indicator.
ADX The Average Directional Index.


*For illustrative purposes only. Not a recommendation of a specific security or investment strategy.