Momentum Indicators

DMI: Directional Movement & Trend Strength | AlfaTactix

📖 6 min read

📝 1,049 words

🏷️ Momentum Indicators

In this page: what DMI is, how it works, when to use it, a practical example with code, and a bonus tip.

Use DMI in a real strategy—no code required

Create a free account to save your progress and build strategies with this indicator and 80+ others in minutes. Backtest, then export to MQL5.


DMI on a price chart: illustration of the indicator and how it is used in technical analysis
DMI – chart illustration

DMI (Directional Movement Index) Indicator Explanation

The Directional Movement Index (DMI) is a momentum indicator that measures the strength of a trend by comparing upward and downward price movements. Developed by J. Welles Wilder Jr. in 1978 and introduced in his book "New Concepts in Technical Trading Systems," DMI consists of three components: +DI (Plus Directional Indicator), -DI (Minus Directional Indicator), and ADX (Average Directional Index). The +DI and -DI lines measure upward and downward directional movement respectively, while ADX measures trend strength regardless of direction. DMI is particularly effective for identifying trend strength, direction, and potential trend changes through directional movement analysis.

How DMI Works: DMI calculates directional movement by comparing current high/low prices to previous high/low prices. +DM (Plus Directional Movement) = Current High - Previous High (if positive and greater than |Current Low - Previous Low|), otherwise 0. -DM (Minus Directional Movement) = |Current Low - Previous Low| (if greater than |Current High - Previous High|), otherwise 0. The Directional Indicators are then calculated using smoothed values: +DI = 100 × (+DM Smoothed / ATR Smoothed), and -DI = 100 × (-DM Smoothed / ATR Smoothed). The ADX measures trend strength by calculating the absolute difference between +DI and -DI, then smoothing: ADX = 100 × (|+DI - -DI| / (+DI + -DI)) smoothed. ADX values above 25 typically indicate strong trends, while values below 20 indicate weak or ranging markets.

When to Use DMI:

  • Trend Strength Identification: ADX is highly effective at identifying trend strength regardless of direction. ADX values above 25 indicate strong trends, while values below 20 indicate weak or ranging markets. This makes it valuable for confirming trend strength before entering trades and avoiding ranging markets.
  • Directional Movement Analysis: When +DI crosses above -DI, it signals a potential uptrend, and when -DI crosses above +DI, it signals a potential downtrend. These crossovers provide early signals of trend changes and directional momentum shifts.
  • Trend Following Confirmation: Using DMI components together provides comprehensive trend analysis: +DI/-DI crossovers indicate direction, while ADX confirms strength. This combination helps traders enter strong trends and avoid weak or ranging markets, improving trade quality.

Advantages:

  • Provides comprehensive trend analysis through three components working together: direction (+DI/-DI) and strength (ADX), giving traders complete information about market conditions. The combination reduces false signals by requiring trend confirmation.
  • Works effectively across multiple timeframes and asset classes, including stocks, forex, commodities, and cryptocurrencies. The indicator adapts well to different market conditions and volatility levels.
  • Helps identify ranging markets through low ADX values (below 20), allowing traders to avoid trend-following strategies during consolidation periods. This information is valuable for adjusting trading strategies based on market conditions.

Limitations:

  • DMI can lag behind price movements during rapid market changes, as it relies on smoothed calculations and ATR. This lag can result in delayed entry and exit signals, potentially missing early trend changes.
  • The indicator may produce false signals in ranging markets when +DI and -DI frequently cross over without clear directional movement, leading to whipsaws. ADX below 20 helps filter these false signals.
  • DMI does not provide information about overbought or oversold conditions, only trend direction and strength. Traders should combine it with oscillators for more comprehensive analysis.

In summary, DMI is a valuable momentum indicator that provides comprehensive trend analysis through directional movement and strength measurement, making it ideal for traders seeking to identify strong trends and avoid ranging markets. For comprehensive understanding, refer to Wilder's original work "New Concepts in Technical Trading Systems" (1978), Investopedia's DMI guide, TradingView's DMI documentation, and academic research on directional movement indicators in technical analysis published in journals such as the Journal of Financial Markets and the Review of Financial Studies.

Practical Example: Using the DMI Indicator in a Trading Strategy

The Directional Movement Index (DMI) is a momentum indicator used to identify trend direction and strength through directional movement analysis. In a trading strategy, the DMI indicator helps traders make entry and exit decisions based on trend direction (+DI/-DI crossovers) and trend strength (ADX values).

Scenario: You're creating a trend-following strategy for Bitcoin (BTC/USDT) on a 4-hour chart. You want to buy when +DI crosses above -DI with ADX above 25 (indicating strong uptrend), and sell when -DI crosses above +DI or ADX falls below 20 (indicating trend reversal or weakening).

Strategy Logic:

  • Calculate the DMI(14) using a 14-period calculation. The DMI provides trend direction through +DI/-DI crossovers and trend strength through ADX values. ADX above 25 indicates strong trends, while ADX below 20 indicates weak or ranging markets.
  • Buy signal: When +DI crosses above -DI and ADX is above 25, indicating a strong uptrend beginning with upward directional movement and strong trend strength.
  • Sell signal: When -DI crosses above +DI or ADX falls below 20, indicating potential downtrend beginning or trend weakening with loss of trend strength.

Backtrader Example:

import backtrader as bt

class DMITrendStrategy(bt.Strategy):
    params = dict(
        dmi_period=14,
        adx_threshold=25
    )
    
    def __init__(self):
        self.dmi = bt.ind.DX(period=self.p.dmi_period)
        # +DI and -DI would be calculated separately in practice
        # For demonstration, using simplified approach
        self.adx = bt.ind.ADX(period=self.p.dmi_period)
        
    def next(self):
        if not self.position:
            # Buy when +DI crosses above -DI and ADX is above threshold
            # Simplified: In practice, calculate +DI and -DI separately
            if self.adx[0] > self.p.adx_threshold:
                self.buy()
        else:
            # Sell when ADX falls below threshold (trend weakening)
            if self.adx[0] < self.p.adx_threshold * 0.8:
                self.sell()

# Usage
cerebro = bt.Cerebro()
cerebro.addstrategy(DMITrendStrategy)

Expected Outcome: By using the DMI indicator, your strategy identifies strong trends and avoids ranging markets, helping you enter trades only when trends are strong (ADX > 25) and exit when trends weaken or reverse. This approach leads to better trend-following performance, improved trade quality, and enhanced risk management by trading only during strong trends with clear directional movement.

💡 Bonus Tip

Consider using DMI in combination with Parabolic SAR for comprehensive trend analysis. When ADX is above 25 (strong trend) and Parabolic SAR indicates the same direction, it suggests a strong trend with high probability of continuation. This technique, documented in Wilder's original methodology, can significantly improve the reliability of DMI-based trading strategies.

Using the DMI indicator ensures your strategy identifies strong trends effectively and avoids ranging markets, improving entry and exit timing based on directional movement and trend strength analysis.

Use DMI in a real strategy—no code required

Create a free account to save your progress and build strategies with this indicator and 80+ others in minutes. Backtest, then export to MQL5.

Try Strategy Builder

Use this indicator in Strategy Builder — free

Create free account