To calculate the DMI, you must determine +DM, -DM, and the ADX. +DM is the current high minus the previous high, while -DM is the previous low minus the current low. After smoothing these values over a period, typically 14 days, you divide them by the Average True Range (ATR) to obtain the +DI and -DI. The ADX is a moving average of the DX, which compares the difference between +DI and -DI.