mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-15 09:08:04 +00:00
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:
@@ -1,5 +1,7 @@
|
||||
# IMI: Intraday Momentum Index
|
||||
|
||||
> *Intraday momentum index applies RSI logic to candle bodies — bullish closes accumulate strength, bearish closes accumulate weakness.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -64,39 +66,6 @@ When both sums are zero (all doji bars in window), IMI defaults to 50.0 (neutral
|
||||
|--------|-----------|---------|------------|
|
||||
| $N$ | period | 14 | $N \geq 1$ |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
Initialize:
|
||||
gainBuf = RingBuffer(period)
|
||||
lossBuf = RingBuffer(period)
|
||||
gainSum = lossSum = 0
|
||||
bar_count = 0
|
||||
|
||||
On each bar (open, close, isNew):
|
||||
if !isNew: restore previous state
|
||||
|
||||
// Classify bar
|
||||
diff = close - open
|
||||
gain = diff > 0 ? diff : 0
|
||||
loss = diff < 0 ? -diff : 0
|
||||
|
||||
// Update rolling sums
|
||||
if gainBuf is full:
|
||||
gainSum -= gainBuf.Oldest
|
||||
lossSum -= lossBuf.Oldest
|
||||
gainBuf.Add(gain)
|
||||
lossBuf.Add(loss)
|
||||
gainSum += gain
|
||||
lossSum += loss
|
||||
|
||||
// IMI calculation
|
||||
total = gainSum + lossSum
|
||||
IMI = total > 0 ? 100 × gainSum / total : 50.0
|
||||
|
||||
output = IMI
|
||||
```
|
||||
|
||||
### IMI vs RSI Comparison
|
||||
|
||||
| Property | RSI | IMI |
|
||||
|
||||
Reference in New Issue
Block a user