Systemicbeta

Directional Movement Index

systemic:core-dmiIndicators

Inputs

NameTypeDescription
WindowWhole numberThe number of bars (e.g., 14) over which the DMI values are smoothed.
Price HighNumber seriesThe highest price of the asset for each bar.
Price LowNumber seriesThe lowest price of the asset for each bar.
Price CloseNumber seriesThe closing price of the asset for each bar.

Outputs

NameTypeDescription
DmiNumber seriesThe Directional Index (DX): the strength of the trend from 0 to 100, whatever its direction.
+DINumber seriesThe strength of upward price movement, from 0 to 100.
-DINumber seriesThe strength of downward price movement, from 0 to 100.

Cost

18
credits per run
1,000
bars

0.2 + 0.0174·n credits for n bars, rounded up. The marks are each plan's limit of bars.

Overview

The Directional Movement Index (DMI), developed by J. Welles Wilder Jr., is a classic technical analysis tool for measuring the strength and direction of market trends. DMI is widely used in both traditional securities (stocks, ETFs, futures) and cryptocurrencies to tell trending markets from ranging ones and to generate signals. It has three main elements:

  • +DI (Positive Directional Indicator): Measures upward trend strength
  • -DI (Negative Directional Indicator): Measures downward trend strength
  • DX (Directional Index): Measures trend strength at the current bar, whatever the direction. This is the module's third output. The ADX is a further-smoothed DX (a moving average of DX over the window); this module does not output it.

DMI is often used together 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 has several steps that smooth price movements to filter out noise. The key formulas are:

1. True Range (TR)

True Range is the widest of the bar's own range and the gap from the previous bar's Close:

TRt=max⁡(Hight−Lowt, ∣Hight−Closet−1∣, ∣Lowt−Closet−1∣)\text{TR}_t = \max(\text{High}_t - \text{Low}_t,\ |\text{High}_t - \text{Close}_{t-1}|,\ |\text{Low}_t - \text{Close}_{t-1}|)

When the previous bar's Close is missing (for example a gap in the Close series), TR is the bar's own High − Low range. A missing Close never makes a bar empty.

2. Directional Movements

+DMt=Hight−Hight−1+\text{DM}_t = \text{High}_t - \text{High}_{t-1} −DMt=Lowt−1−Lowt-\text{DM}_t = \text{Low}_{t-1} - \text{Low}_t

If +DMt>−DMt+\text{DM}_t > -\text{DM}_t and +DMt>0+\text{DM}_t > 0, use +DMt+\text{DM}_t; else 0. If −DMt>+DMt-\text{DM}_t > +\text{DM}_t and −DMt>0-\text{DM}_t > 0, use −DMt-\text{DM}_t; else 0.

3. Smoothed Values

Apply Wilder's smoothing over the window NN (usually 14 bars):

Smoothed +DMt=Previous Smoothed +DM−(Previous Smoothed +DM/N)++DMt\text{Smoothed } +\text{DM}_t = \text{Previous Smoothed } +\text{DM} - (\text{Previous Smoothed } +\text{DM} / N) + +\text{DM}_t

(similar for −DM-\text{DM} and TR\text{TR})

4. Directional Indicators

+DIt=(Smoothed +DMtSmoothed TRt)×100+\text{DI}_t = \left(\frac{\text{Smoothed } +\text{DM}_t}{\text{Smoothed TR}_t}\right) \times 100 −DIt=(Smoothed −DMtSmoothed TRt)×100-\text{DI}_t = \left(\frac{\text{Smoothed } -\text{DM}_t}{\text{Smoothed TR}_t}\right) \times 100

5. Directional Index (DX) and ADX

DXt=∣+DIt−−DIt+DIt+−DIt∣×100\text{DX}_t = \left|\frac{+\text{DI}_t - -\text{DI}_t}{+\text{DI}_t + -\text{DI}_t}\right| \times 100 ADXt=SMA of DX over N bars\text{ADX}_t = \text{SMA of DX over N bars}

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 --> G[DMI Output: +DI, -DI, DX]

Signal Generation Workflow

sequenceDiagram
    participant Market
    participant DMI
    participant Trader
    Market->>DMI: Price data
    DMI->>DMI: Compute +DI, -DI, DX
    DMI->>Trader: Signal (+DI cross, -DI cross, DX > 25)
    Trader->>Market: Decide to 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 useful 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
  • Works across asset classes and periods

Limitations:

  • Lagging indicator (uses smoothed data)
  • Can generate false signals in choppy markets
  • The window needs tuning for different assets

References and Further Reading


Data Alignment in Systemic

DMI needs three aligned price series (High, Low, Close) from the same asset and period.

Input Requirements

InputTypeAlignment Behavior
Price HighSeriesMust match length of Low and Close
Price LowSeriesMust match length of High and Close
Price CloseSeriesMust match length of High and Low
WindowConstantNumber of bars in the window (no alignment needed)

Automatic Alignment

If your price inputs have different periods:

  • All inputs are placed on the bars of the fastest series
  • A slower series repeats its last value until its next one

Critical: All three price series should come from the same asset and period. Mixing price data from different sources gives DMI readings with no meaning.


Missing Data

DMI needs both High and Low on every bar it uses. Price Close is used for True Range when it is available, but it is not required: if the previous Close is missing, True Range is that bar's High − Low range. The Window counts bars that have data, not calendar time. Across a market-closed gap (holiday, weekend, no data) the smoothing continues from the last bar before the gap to the first bar after it. The first window bars with data have no +DI/-DI/DX value. This shows as a gap, not as a zero. In a flat window (High and Low both constant) +DI and -DI are 0.0, and DX, which would be 0/0, is empty. The Window cannot be larger than the number of bars in the run.


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]
DimensionStocks/MacroCryptoExplanation
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 charting 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 periods 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.

Rendering diagrams...
© 2026 WanoLabs. All rights reservedBeta v0.1.5