mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 18:18: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 @@
|
||||
# VWAPSD: VWAP with Standard Deviation Bands
|
||||
|
||||
> *Standard deviation bands around VWAP measure institutional consensus — proximity signals fair value, distance signals opportunity.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Channel |
|
||||
@@ -84,40 +86,6 @@ Streaming: $O(1)$ per bar. Three additions to running sums, one division, one sq
|
||||
|--------|------|---------|------------|-------------|
|
||||
| $k$ | numDevs | 2.0 | $0.1$ – $5.0$ | Number of standard deviations for bands |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
function vwapsd(source[], volume[], reset[], numDevs):
|
||||
sum_pv = 0, sum_vol = 0, sum_pv2 = 0
|
||||
|
||||
for each bar t:
|
||||
price = source[t]
|
||||
vol = volume[t]
|
||||
|
||||
if reset[t]:
|
||||
if vol > 0:
|
||||
sum_pv = price * vol
|
||||
sum_vol = vol
|
||||
sum_pv2 = price * price * vol
|
||||
else:
|
||||
sum_pv = 0, sum_vol = 0, sum_pv2 = 0
|
||||
else:
|
||||
if vol > 0:
|
||||
sum_pv += price * vol
|
||||
sum_vol += vol
|
||||
sum_pv2 += price * price * vol
|
||||
|
||||
vwap = sum_vol > 0 ? sum_pv / sum_vol : price
|
||||
|
||||
variance = sum_vol > 0 ? sum_pv2 / sum_vol - vwap * vwap : 0
|
||||
stddev = sqrt(max(0, variance))
|
||||
|
||||
upper = vwap + numDevs * stddev
|
||||
lower = vwap - numDevs * stddev
|
||||
|
||||
emit (vwap, upper, lower)
|
||||
```
|
||||
|
||||
### VWAPSD vs VWAPBANDS
|
||||
|
||||
| Aspect | VWAPSD | VWAPBANDS |
|
||||
|
||||
Reference in New Issue
Block a user