mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-21 03:58: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 @@
|
||||
# ATRBANDS: Average True Range Bands
|
||||
|
||||
> *True range bands let volatility itself draw the envelope — wider when uncertain, tighter when resolved.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Channel |
|
||||
@@ -72,33 +74,6 @@ The SMA uses a circular buffer for $O(1)$ running sums. The ATR uses recursive I
|
||||
| Gap-up | $\|H_t - C_{t-1}\|$ | Upward gap distance |
|
||||
| Gap-down | $\|L_t - C_{t-1}\|$ | Downward gap distance |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
function ATRBANDS(source, high, low, close, period, multiplier):
|
||||
validate: period > 0, multiplier > 0
|
||||
|
||||
// True Range
|
||||
tr = max(high - low, |high - prev_close|, |low - prev_close|)
|
||||
prev_close = close
|
||||
|
||||
// ATR via Wilder's smoothing (RMA)
|
||||
alpha = 1 / period
|
||||
raw_rma = (raw_rma * (period - 1) + tr) / period
|
||||
e *= (1 - alpha)
|
||||
atr = e > ε ? raw_rma / (1 - e) : raw_rma
|
||||
|
||||
// Center line (SMA via circular buffer)
|
||||
middle = SMA(source, period)
|
||||
|
||||
// Bands
|
||||
width = atr * multiplier
|
||||
upper = middle + width
|
||||
lower = middle - width
|
||||
|
||||
return [middle, upper, lower]
|
||||
```
|
||||
|
||||
### Output Interpretation
|
||||
|
||||
| Output | Description |
|
||||
|
||||
Reference in New Issue
Block a user