Directional Movement Index
systemic:core-dmiIndicatorsfunction1 crInputs
| Name | Type | Description |
|---|---|---|
| Window | integer | The number of periods (e.g., days) over which the DMI is calculated. |
| Price High | floatarray | The highest price of the asset for the given time period. |
| Price Low | floatarray | The lowest price of the asset for the given time period. |
| Price Close | floatarray | The closing price of the asset for the given time period. |
Outputs
| Name | Type | Description |
|---|---|---|
| Dmi | floatarray | - **Description**; The DMI is an indicator that combines the +DI and -DI to determine the overall strength of a trend. It is often used in conjunction with the Average Directional Index (ADX) to confirm trend direction and strength. |
| +DI | floatarray | - **Description**; The +DI measures the strength of upward price movements. It indicates the extent to which the price is moving up compared to the previous period. |
| -DI | floatarray | - **Description**; The -DI measures the strength of downward price movements. It indicates the extent to which the price is moving down compared to the previous period. |
Overview
The Directional Movement Index (DMI), developed by J. Welles Wilder Jr., is a cornerstone of technical analysis for identifying the strength and direction of market trends. DMI is widely used in both traditional securities (stocks, ETFs, futures) and cryptocurrencies to distinguish trending from ranging markets and to generate actionable trading signals. It is composed of three main elements:
- +DI (Positive Directional Indicator): Measures upward trend strength
- -DI (Negative Directional Indicator): Measures downward trend strength
- DX (Directional Index): Quantifies trend strength for the current period, regardless of direction — this module's third output. A trader who wants the further-smoothed ADX (a simple moving average of DX over the window) can compute it downstream from this output.
DMI is often used in conjunction with other indicators (e.g., Average True Range (ATR), Moving Averages) to refine entries and exits. For a historical perspective, see Wilder's original work.
Mathematical Formulation
The DMI calculation involves several steps, each smoothing price movements to filter out noise. Below are the key formulas:
1. True Range (TR)
True Range is the widest of the bar's own range and the gap from the previous bar's Close:
When the previous bar's Close is missing (for example the first bar of the series, or a data gap), TR falls back to the bar's own High − Low range — a missing Close never invalidates a bar.
2. Directional Movements
If and , use ; else 0. If and , use ; else 0.
3. Smoothed Values
Apply a smoothing (usually Wilder's 14-period):
(similar for and )
4. Directional Indicators
5. Directional Index (DX) and ADX
Visualizing DMI
Calculation Flow
flowchart TD
A[Price Data] --> B[Calculate TR, +DM, -DM]
B --> C[Apply Smoothing]
C --> D[Compute +DI, -DI]
D --> E[Calculate DX]
E --> F[Compute ADX]
F --> G[DMI Output: +DI, -DI, ADX]
Signal Generation Workflow
sequenceDiagram
participant Market
participant DMI
participant Trader
Market->>DMI: New price data
DMI->>DMI: Update +DI, -DI, ADX
DMI->>Trader: Signal (+DI cross, -DI cross, ADX > 25)
Trader->>Market: Execute trade or hold
Practical Use Cases
In Securities
- Trend Confirmation: DMI helps confirm if a stock is in a strong uptrend or downtrend, filtering out sideways markets.
- Entry/Exit Signals: Crossovers of +DI and -DI, especially when ADX is above a threshold (commonly 20 or 25), are used for entries and exits.
- Volatility Regimes: ADX rising signals strengthening trends, while falling ADX warns of choppy/range-bound conditions.
In Cryptocurrencies
- Volatility Adaptation: Crypto markets are highly volatile; DMI can help avoid false breakouts by requiring ADX confirmation.
- Risk Management: During high ADX periods, traders may increase position size; during low ADX, reduce risk or avoid trading.
DMI in Macroeconomic Context
DMI is most powerful when combined with macro indicators such as CPI, VIX, and interest rates. For example, in a high-inflation, high-volatility regime, DMI can help filter out false breakouts and focus on robust trends.
flowchart TD
A[Macro Data: CPI, VIX, Rates] --> B[Market Regime]
B --> C{Trending?}
C -->|Yes| D[Use DMI for Signal Confirmation]
C -->|No| E[Reduce Risk, Avoid Trend Signals]
Example:
- If CPI is rising and VIX is elevated, but DMI/ADX is low, avoid trend trades.
- If CPI is stable, VIX is low, and ADX is rising, trend-following strategies using DMI are favored.
For more on macro integration, see Investopedia: Using Technicals with Macro.
Advantages and Limitations
Advantages:
- Measures both trend direction and strength
- Helps avoid whipsaws in sideways markets
- Versatile across asset classes and timeframes
Limitations:
- Lagging indicator (uses smoothed data)
- Can generate false signals in choppy markets
- Requires parameter tuning for different assets
References and Further Reading
- Investopedia: Directional Movement Index (DMI)
- StockCharts: DMI/ADX
- Binance Academy: ADX and DMI
- Wilder, J. Welles: New Concepts in Technical Trading Systems
Data Alignment in Systemic
DMI requires three aligned price series (High, Low, Close) from the same asset and timeframe.
Input Requirements
| Input | Type | Alignment Behavior |
|---|---|---|
| Price High | Series | Must match length of Low and Close |
| Price Low | Series | Must match length of High and Close |
| Price Close | Series | Must match length of High and Low |
| Window | Constant | Lookback period (no alignment needed) |
Automatic Alignment
If your price inputs have different frequencies:
- All inputs are upsampled to the finest resolution
- Forward-fill is applied to maintain the last known value
Critical: All three price series should come from the same asset and timeframe. Mixing price data from different sources produces invalid DMI readings.
Missing Data
DMI needs High and Low together on every bar it uses — Price Close is read opportunistically
for gap-aware True Range when available, and never required: a bar is never blanked by a
missing Close (True Range simply falls back to that bar's High − Low range). The Window setting means N bars
actually observed, not N calendar slots: on a market-closed gap (holiday, weekend, no data), the
Wilder smoothing keeps counting back through real bars, bridging straight from the last session
before the gap to the first session after it. Until the first window observed bars accumulate,
+DI/-DI/DX have no value yet — this shows as a gap, never a misleading zero. A flat window (High
and Low both constant, so up-moves and down-moves cancel) is the one case that legitimately
produces +DI = -DI = 0.0 — DX itself is then an honest 0/0 and reports as a gap too.
Indicator Assessment
%%{init: {"themeVariables": {"cScale0": "#4F46E5", "cScale1": "#059669"}}}%%
quadrantChart
title DMI Indicator Assessment
x-axis Low --> High
y-axis Low --> High
quadrant-1 High Popularity & Reliability
quadrant-2 High Reliability & Low Popularity
quadrant-3 Low Reliability & Popularity
quadrant-4 High Popularity & Low Reliability
"Traditional Markets": [0.85, 0.80]
"Cryptocurrency": [0.70, 0.65]
| Dimension | Stocks/Macro | Crypto | Explanation |
|---|---|---|---|
| Popularity | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | DMI/ADX is one of the most widely used trend indicators in technical analysis, created by J. Welles Wilder who also created RSI. Standard in most trading platforms. |
| Reliability | ⭐⭐⭐⭐ | ⭐⭐⭐ | Highly reliable for trend confirmation in trending markets. However, it's a lagging indicator and can generate false signals in choppy, ranging markets. |
| Complexity | ⭐⭐⭐ | ⭐⭐⭐ | Multi-step calculation involving True Range, directional movements, and smoothing. Interpretation requires understanding of +DI/-DI crossovers and ADX thresholds. |
| Versatility | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | Works across all timeframes and asset classes. Best for trend-following strategies; less effective in ranging markets. The three outputs (+DI, -DI, DMI) provide both direction and strength. |
| Recent Interest | ⭐⭐⭐ | ⭐⭐⭐ | Steady interest as a foundational indicator. Often combined with other Wilder indicators (RSI, ATR) in systematic trading. |
Glossary
- +DI / -DI: Positive/Negative Directional Indicator
- ADX: Average Directional Index
- True Range (TR): Largest of current high-low, high-previous close, low-previous close
- Smoothing: Averaging technique to reduce noise
- Crossover: When one indicator line crosses another, often used as a signal
- Volatility Regime: Market state defined by high or low volatility (see VIX)
- Macro Indicator: Economic data such as CPI, interest rates, or employment
This documentation is for educational purposes and should not be considered investment advice. Always consult multiple sources and consider your risk tolerance before trading.