- **Similar:** [WMA](../wma/wma.md), [FWMA](../fwma/fwma.md) | **Complementary:** Volume confirmation | **Trading note:** Distance-Weighted MA; assigns weights based on distance from current bar.
DWMA (Double Weighted Moving Average) is exactly what it says on the tin: a Weighted Moving Average of a Weighted Moving Average. Unlike DEMA, which tries to *remove* lag, DWMA accepts lag as the price of admission for superior noise reduction. It produces a curve that is incredibly smooth, ideal for identifying long-term trends without getting faked out by market chop.
## Historical Context
There is no single "inventor" of DWMA; it's a natural extension of linear filtering. It represents a higher-order filter that prioritizes recent data (via WMA) but applies a second pass to iron out any remaining wrinkles. It's the heavy artillery of smoothing.
## Architecture & Physics
DWMA applies a linear weight kernel (triangle window) twice.
1.**Pass 1**: Calculate WMA of the price.
2.**Pass 2**: Calculate WMA of the result from Pass 1.
The effective window size is roughly $2 \times \text{Period}$, and the lag is cumulative. This is not for high-frequency scalping; this is for determining if the market is actually bullish or just having a manic episode.
## Mathematical Foundation
$$ \text{WMA}_1 = \text{WMA}(P, N) $$
$$ \text{DWMA} = \text{WMA}(\text{WMA}_1, N) $$
The weight profile of a single WMA is triangular. The weight profile of a DWMA approaches a Gaussian-like shape (central limit theorem in action), but heavily skewed towards recent data due to the WMA's linear weighting.
## Performance Profile
### Operation Count (Streaming Mode, Scalar)
DWMA chains two WMA instances. Each WMA is O(1) with ~22 cycles (see WMA.md).
DWMA is implemented by chaining two `Wma` instances. Since `Wma` is zero-allocation, DWMA inherits this property.
## Validation
Validated against chained WMA implementations in standard libraries.
| Library | Status | Notes |
| :--- | :--- | :--- |
| **QuanTAlib** | ✅ | Validated against `WMA(WMA)`. |
| **Skender** | ✅ | Validated against chained `GetWma`. |
| **TA-Lib** | ✅ | Validated against chained `TA_WMA`. |
| **Tulip** | ✅ | Validated against chained `wma`. |
| **Ooples** | ✅ | Validated against chained `CalculateWeightedMovingAverage`. |
### Common Pitfalls
1.**Lag**: This indicator lags. A lot. Do not use it for entry signals on tight timeframes. Use it for trend filtering (e.g., "only buy if price > DWMA").
2.**Warmup**: It takes roughly $2 \times N$ bars to produce valid data.