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 @@
|
||||
# CHOP: Choppiness Index
|
||||
|
||||
> *Choppiness index quantifies how range-bound a market is — high values mean sideways, low values mean trending.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Dynamic |
|
||||
@@ -56,50 +58,6 @@ The denominator $\log_{10}(N)$ normalizes the output so that the theoretical max
|
||||
|--------|-----------|---------|------------|
|
||||
| $N$ | period | 14 | $N \geq 2$ |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
Initialize:
|
||||
trBuf = RingBuffer(period)
|
||||
highBuf = RingBuffer(period)
|
||||
lowBuf = RingBuffer(period)
|
||||
trSum = 0
|
||||
prevClose = NaN
|
||||
logPeriod = log10(period)
|
||||
|
||||
On each bar (high, low, close, isNew):
|
||||
if !isNew: restore previous state
|
||||
|
||||
// True Range
|
||||
if prevClose is valid:
|
||||
TR = max(high - low, |high - prevClose|, |low - prevClose|)
|
||||
else:
|
||||
TR = high - low
|
||||
|
||||
// Rolling sum update
|
||||
if trBuf is full:
|
||||
trSum -= trBuf.Oldest
|
||||
trBuf.Add(TR)
|
||||
trSum += TR
|
||||
|
||||
highBuf.Add(high)
|
||||
lowBuf.Add(low)
|
||||
|
||||
// Channel width
|
||||
maxHigh = Max(highBuf)
|
||||
minLow = Min(lowBuf)
|
||||
channel = maxHigh - minLow
|
||||
|
||||
// Choppiness Index
|
||||
if channel > 0 AND trSum > 0:
|
||||
CHOP = 100 × log10(trSum / channel) / logPeriod
|
||||
else:
|
||||
CHOP = 50 // neutral fallback
|
||||
|
||||
prevClose = close
|
||||
output = Clamp(CHOP, 0, 100)
|
||||
```
|
||||
|
||||
### Interpretation
|
||||
|
||||
| CHOP Value | Market Regime | Strategy Implication |
|
||||
|
||||
Reference in New Issue
Block a user