- VWMA (Volume Weighted Moving Average) calculates a moving average where each price is weighted by its corresponding volume over a specified lookbac...
VWMA (Volume Weighted Moving Average) calculates a moving average where each price is weighted by its corresponding volume over a specified lookback period. Unlike VWAP which accumulates from a reset point, VWMA uses a sliding window that continuously drops old values, making it a true moving average. Bars with higher volume contribute more to the average, surfacing price levels where institutional activity concentrated.
## Historical Context
Volume-weighted calculations predate modern technical analysis, with floor traders intuitively weighting their mental price averages by the volume they observed at each level. The formalization of VWMA emerged alongside computing power in the 1970s-80s when chartists could finally automate what was previously impossible to calculate by hand.
VWMA gained popularity as an alternative to simple moving averages (SMA) after practitioners noticed that treating all bars equally ignored crucial market information. A bar where 10 million shares traded at $100 conveys far more information about fair value than a bar where 10,000 shares traded at $105. SMA treats them identically; VWMA does not.
The distinction from VWAP is critical: VWAP resets at session boundaries and accumulates indefinitely, while VWMA maintains a fixed lookback window. This makes VWMA more responsive to recent price action and suitable for trend-following applications where you want volume confirmation without anchoring bias.
## Architecture & Physics
VWMA operates as a sliding window weighted average with circular buffer state management.
### 1. Sliding Window Design
Unlike cumulative indicators, VWMA must track and remove old values as new ones arrive:
**Net batch improvement**: ~25-30% due to multiplication dominating early bars.
### Quality Metrics
| Metric | Score | Notes |
| :--- | :---: | :--- |
| **Accuracy** | 10/10 | Exact weighted average |
| **Timeliness** | 8/10 | Lags by ~period/2 bars |
| **Overshoot** | 2/10 | Minimal overshoot |
| **Smoothness** | 7/10 | Smoother than SMA when volume varies |
## Validation
| Library | Status | Notes |
| :--- | :---: | :--- |
| **TA-Lib** | N/A | Not implemented |
| **Skender** | ✅ | Matches `GetVwma(period)` within tolerance |
| **Tulip** | N/A | Not implemented |
| **Ooples** | N/A | Not implemented |
| **Self-consistency** | ✅ | Streaming/Batch/Span modes match |
## Common Pitfalls
1.**Warmup Period**: First `period-1` bars use partial window. `IsHot` becomes true only after `period` bars accumulated. Expect different values during warmup vs full window operation.
2.**Memory Scaling**: Unlike cumulative indicators, VWMA requires O(period) memory. Very large periods (>10,000) should consider memory implications: 10,000 period ≈ 160KB per instance.
3.**Zero Volume Handling**: When total volume in window is zero, VWMA returns current price. This is rare in liquid markets but can occur with filtered or synthetic data.
4.**VWAP Confusion**: VWMA uses sliding window (drops old values); VWAP uses cumulative window (never drops). They serve different purposes—don't interchange them.
5.**TBar vs TValue**: `Update(TBar)` uses close price and bar volume. `Update(TValue)` uses value as price with synthetic volume=1, losing volume-weighting benefits. Prefer TBar input for meaningful VWMA.
6.**Circular Buffer State**: Bar correction (`isNew=false`) restores previous state completely. Multiple corrections on same bar work correctly.
## References
- Arms, R. (1989). "Volume Cycles in the Stock Market." Equis International.
- Achelis, S. (2000). "Technical Analysis from A to Z." McGraw-Hill.