2026-02-27 07:48:12 -08:00
# DX: Directional Movement Index
2026-03-11 20:21:52 -07:00
> *Directional movement captures the difference between positive and negative thrust, normalized by true range.*
2026-02-27 07:48:12 -08:00
| Property | Value |
| ---------------- | -------------------------------- |
| **Category** | Dynamic |
| **Inputs** | OHLCV bar (TBar) |
| **Parameters** | `period` (default 14) |
| **Outputs** | Multiple series (DiPlus, DiMinus) |
| **Output range** | Varies (see docs) |
| **Warmup** | `period` bars |
2026-03-11 15:35:33 -07:00
| **PineScript** | [dx.pine ](dx.pine ) |
2026-02-27 07:48:12 -08:00
- The Directional Movement Index is the raw, unsmoothed measure of trend strength from Wilder's directional movement system.
2026-03-13 13:46:52 -07:00
- **Similar:** [ADX ](../adx/Adx.md ), [ADXR ](../adxr/Adxr.md ) | **Complementary:** +DI/-DI for direction | **Trading note:** Directional Index; unsmoothed ADX. More responsive but noisier.
2026-02-27 07:48:12 -08:00
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
The Directional Movement Index is the raw, unsmoothed measure of trend strength from Wilder's directional movement system. It decomposes price expansion into +DM and -DM, normalizes against True Range using RMA smoothing to produce +DI and -DI, then computes the ratio $DX = 100 \times |{+DI - {-DI}}| / ({+DI + {-DI}})$. Unlike ADX, which applies a final RMA pass to DX, the raw DX responds immediately to changes in directional dominance — making it noisier but approximately one full period faster. Output ranges from 0 to 100, where high values indicate strong directional movement regardless of up/down direction. DX is the building block from which ADX is derived.
2026-02-06 07:43:40 -08:00
## Historical Context
2026-02-20 21:40:32 -08:00
J. Welles Wilder Jr. introduced the complete Directional Movement System in *New Concepts in Technical Trading Systems* (1978). The system's pipeline produces several intermediate values — +DM, -DM, TR, +DI, -DI, DX — before reaching the final ADX. Most traders skip directly to ADX, but DX occupies a useful middle ground: it contains all the directional normalization logic (the hard part) without the final smoothing layer (which adds lag). For traders who can tolerate more noise in exchange for faster response, DX provides trend strength signals roughly $N$ bars ahead of ADX. The tradeoff is straightforward: DX spikes on volatile bars and can produce false readings during whipsaw, while ADX absorbs these transients through its additional RMA pass.
2026-02-06 07:43:40 -08:00
## Architecture & Physics
2026-02-20 21:40:32 -08:00
### 1. Directional Movement
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$\text{UpMove} = H_t - H_{t-1}, \quad \text{DownMove} = L_{t-1} - L_t$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$+DM = \begin{cases} \text{UpMove} & \text{if UpMove} > \text{DownMove and UpMove} > 0 \\ 0 & \text{otherwise} \end{cases}$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$-DM = \begin{cases} \text{DownMove} & \text{if DownMove} > \text{UpMove and DownMove} > 0 \\ 0 & \text{otherwise} \end{cases}$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
### 2. True Range
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$TR = \max(H_t - L_t,\; |H_t - C_{t-1}|,\; |L_t - C_{t-1}|)$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
### 3. Wilder Smoothing (RMA)
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
All three series use Wilder's smoothing with $\alpha = 1/N$:
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$+DM_{\text{smooth}} = \text{RMA}(+DM, N)$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$-DM_{\text{smooth}} = \text{RMA}(-DM, N)$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$TR_{\text{smooth}} = \text{RMA}(TR, N)$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
### 4. Directional Indicators
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$+DI = 100 \times \frac{+DM_{\text{smooth}}}{TR_{\text{smooth}}}$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$-DI = 100 \times \frac{-DM_{\text{smooth}}}{TR_{\text{smooth}}}$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
### 5. DX (No Final Smoothing)
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
$$DX = 100 \times \frac{|+DI - (-DI)|}{+DI + (-DI)}$$
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
When $+DI + (-DI) = 0$ (no directional movement), DX = 0.
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
### 6. Complexity
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
- **Time:** $O(1)$ per bar — all RMA updates are recursive
- **Space:** $O(1)$ — scalar state only
- **Warmup:** $N$ bars
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
## Mathematical Foundation
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
### Parameters
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
| Symbol | Parameter | Default | Constraint |
|--------|-----------|---------|------------|
| $N$ | period | 14 | $N \geq 2$ |
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
### DX vs ADX
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
| Property | DX | ADX |
|----------|-----|------|
| Smoothing | RMA on components only | RMA on components + RMA on DX |
| Response | Immediate to bar-level changes | Lagged by $\approx N$ bars |
| Noise | High; can spike on volatile bars | Low; smooth, stable signal |
| Use case | Fast trend detection, signal generation | Regime classification, filter |
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
### Interpretation
2026-02-06 07:43:40 -08:00
| DX Value | Trend Strength |
2026-02-20 21:40:32 -08:00
|----------|----------------|
| 0-15 | No meaningful trend |
2026-02-06 07:43:40 -08:00
| 15-25 | Developing trend |
| 25-50 | Strong trend |
| 50-75 | Very strong trend |
2026-02-20 21:40:32 -08:00
| 75-100 | Extreme (rare, usually transient) |
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
DX measures trend *strength* , not direction. Direction is determined by comparing +DI vs -DI: if $+DI > -DI$, the trend is up; if $-DI > +DI$, the trend is down. DI crossovers signal potential trend reversals.
2026-02-06 07:43:40 -08:00
2026-02-26 22:02:52 -08:00
## Performance Profile
### Operation Count (Streaming Mode)
DX is an intermediate step in the ADX calculation: it computes the directional movement index without the final ADX smoothing pass.
**Post-warmup steady state (per bar):**
| Operation | Count | Cost (cycles) | Subtotal |
| :--- | :---: | :---: | :---: |
| SUB × 5 (TR, DM moves) | 5 | 1 | 5 |
| ABS × 2 (TR components) | 2 | 1 | 2 |
| MAX × 2 (TR) | 2 | 1 | 2 |
| CMP × 2 (DM guards) | 2 | 1 | 2 |
| FMA × 3 (RMA TR, +DM, − DM) | 3 | 4 | 12 |
| DIV × 2 (+DI, − DI) | 2 | 15 | 30 |
| MUL × 2 (× 100) | 2 | 3 | 6 |
| ABS + ADD + DIV (DX formula) | 3 | 16 | 16 |
| **Total** | **23** | — | ** ~75 cycles** |
DX requires N bars warmup (vs 2N for ADX). ~75 cycles per bar.
### Batch Mode (SIMD Analysis)
| Operation | Vectorizable? | Notes |
| :--- | :---: | :--- |
| TR/DM initial computation | Yes | VSUBPD + VABSPD + VMAXPD |
| RMA smoothing × 3 | **No** | Recursive IIR |
| DX formula | Yes | VABSPD + VADDPD + VDIVPD post-RMA |
Same RMA bottleneck as ADX. The DX formula itself is fully vectorizable.
### Quality Metrics
| Metric | Score | Notes |
| :--- | :---: | :--- |
| **Accuracy** | 9/10 | FMA smoothing; exact TR computation |
| **Timeliness** | 7/10 | N-bar warmup; more responsive than ADX |
| **Smoothness** | 6/10 | Raw DX is noisier than ADX; typically used as input to ADX |
| **Noise Rejection** | 6/10 | Single RMA layer; moderate noise suppression |
2026-02-20 21:40:32 -08:00
## Resources
2026-02-06 07:43:40 -08:00
2026-02-20 21:40:32 -08:00
- Wilder, J.W. — *New Concepts in Technical Trading Systems* (Trend Research, 1978)
2026-03-13 13:46:52 -07:00
- PineScript reference: `dx.pine` in indicator directory