feat(dynamics): add PlusDI, MinusDI, PlusDM, MinusDM indicators

Complete thin Dx-composition wrapper indicators with full test coverage:

- PlusDi/MinusDi: Directional Indicator wrappers (DiPlus/DiMinus from Dx)
- PlusDm/MinusDm: Directional Movement wrappers (DmPlus/DmMinus from Dx)
- Individual validation tests per indicator directory (TALib, Skender, bounds)
- Combined unit tests (DiDm.Tests.cs) and validation tests (DiDm.Validation.Tests.cs)
- Quantower wrappers + tests for all 4 indicators
- PineScript v6 implementations with compensated RMA
- Normalized .md documentation for all indicators and categories
- 182 tests passing, 0 failures
This commit is contained in:
Miha Kralj
2026-03-11 20:21:52 -07:00
parent 56b86bebfb
commit 33d20f2a18
437 changed files with 4589 additions and 2792 deletions
+2 -43
View File
@@ -1,5 +1,7 @@
# DX: Directional Movement Index
> *Directional movement captures the difference between positive and negative thrust, normalized by true range.*
| Property | Value |
| ---------------- | -------------------------------- |
| **Category** | Dynamic |
@@ -72,49 +74,6 @@ When $+DI + (-DI) = 0$ (no directional movement), DX = 0.
|--------|-----------|---------|------------|
| $N$ | period | 14 | $N \geq 2$ |
### Pseudo-code
```
Initialize:
α = 1 / period
smoothPlusDM = smoothMinusDM = smoothTR = 0
prevHigh = prevLow = prevClose = NaN
On each bar (high, low, close, isNew):
if !isNew: restore previous state
// True Range
TR = max(high - low, |high - prevClose|, |low - prevClose|)
upMove = high - prevHigh
downMove = prevLow - low
+DM = (upMove > downMove AND upMove > 0) ? upMove : 0
-DM = (downMove > upMove AND downMove > 0) ? downMove : 0
// Wilder smoothing
smoothPlusDM = FMA(smoothPlusDM, 1 - α, α × +DM)
smoothMinusDM = FMA(smoothMinusDM, 1 - α, α × -DM)
smoothTR = FMA(smoothTR, 1 - α, α × TR)
// Directional Indicators
+DI = smoothTR > 0 ? 100 × smoothPlusDM / smoothTR : 0
-DI = smoothTR > 0 ? 100 × smoothMinusDM / smoothTR : 0
// DX (raw, no final RMA)
diSum = +DI + -DI
DX = diSum > 0 ? 100 × |+DI - -DI| / diSum : 0
prevHigh = high
prevLow = low
prevClose = close
output:
DX = DX // trend strength (0-100)
DiPlus = +DI // bullish directional indicator
DiMinus = -DI // bearish directional indicator
```
### DX vs ADX
| Property | DX | ADX |