mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-18 02:28:05 +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 @@
|
||||
# BBANDS: Bollinger Bands
|
||||
|
||||
> *Standard deviation channels adapt to the market's own volatility rhythm, expanding and contracting like breathing.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Channel |
|
||||
@@ -78,36 +80,6 @@ The circular buffer maintains running sums of $x$ and $x^2$, enabling $O(1)$ com
|
||||
| 2.0 | 95.4% | 75.0% |
|
||||
| 3.0 | 99.7% | 88.9% |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
function BBANDS(source, period, multiplier):
|
||||
validate: period > 0, multiplier > 0
|
||||
|
||||
// Circular buffer maintains running sums
|
||||
sum += source; sumSq += source²
|
||||
oldest = buffer[head]
|
||||
if oldest exists: sum -= oldest; sumSq -= oldest²
|
||||
|
||||
// SMA (middle band)
|
||||
middle = sum / count
|
||||
|
||||
// Population standard deviation
|
||||
variance = max(0, sumSq/count - middle²)
|
||||
sigma = √variance
|
||||
dev = multiplier * sigma
|
||||
|
||||
// Bands
|
||||
upper = middle + dev
|
||||
lower = middle - dev
|
||||
|
||||
// Derived metrics
|
||||
bandwidth = (upper - lower) / middle
|
||||
percentB = (source - lower) / (upper - lower)
|
||||
|
||||
return [middle, upper, lower, bandwidth, percentB]
|
||||
```
|
||||
|
||||
### Output Interpretation
|
||||
|
||||
| Output | Range | Meaning |
|
||||
|
||||
Reference in New Issue
Block a user