mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-20 11:38: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 @@
|
||||
# VWAPBANDS: VWAP with Dual Standard Deviation Bands
|
||||
|
||||
> *VWAP anchored by dual deviation bands reveals where volume-weighted fair value ends and excess begins.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Channel |
|
||||
@@ -86,48 +88,6 @@ Streaming: $O(1)$ per bar. Three additions to running sums, one division, one sq
|
||||
|--------|------|---------|------------|-------------|
|
||||
| $k$ | multiplier | 1.0 | $> 0$ | Scales the standard deviation for band width |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
function vwapbands(source[], volume[], reset[], multiplier):
|
||||
sum_pv = 0, sum_vol = 0, sum_pv2 = 0, count = 0
|
||||
|
||||
for each bar t:
|
||||
price = source[t]
|
||||
vol = volume[t]
|
||||
|
||||
if reset[t]:
|
||||
// session boundary: restart accumulation
|
||||
if vol > 0:
|
||||
sum_pv = price * vol
|
||||
sum_vol = vol
|
||||
sum_pv2 = price * price * vol
|
||||
count = 1
|
||||
else:
|
||||
sum_pv = 0, sum_vol = 0, sum_pv2 = 0, count = 0
|
||||
else:
|
||||
if vol > 0:
|
||||
sum_pv += price * vol
|
||||
sum_vol += vol
|
||||
sum_pv2 += price * price * vol
|
||||
count += 1
|
||||
|
||||
vwap = sum_vol > 0 ? sum_pv / sum_vol : price
|
||||
|
||||
variance = 0
|
||||
if sum_vol > 0 and count > 1:
|
||||
variance = max(0, sum_pv2 / sum_vol - vwap * vwap)
|
||||
|
||||
stddev = sqrt(variance)
|
||||
|
||||
upper1 = vwap + multiplier * stddev
|
||||
lower1 = vwap - multiplier * stddev
|
||||
upper2 = vwap + 2 * multiplier * stddev
|
||||
lower2 = vwap - 2 * multiplier * stddev
|
||||
|
||||
emit (vwap, upper1, lower1, upper2, lower2, stddev)
|
||||
```
|
||||
|
||||
### Statistical Zone Interpretation
|
||||
|
||||
| Zone | Coverage | Interpretation |
|
||||
|
||||
Reference in New Issue
Block a user