The Double Weighted Moving Average (DWMA) is a smoothing indicator that applies a Weighted Moving Average (WMA) twice. By smoothing the data once and then smoothing the result again, DWMA produces an exceptionally clean curve that filters out significant market noise. The trade-off is increased lag compared to a single WMA, making it more suitable for identifying major trends rather than short-term scalping.
While the concept of double smoothing dates back to the early days of technical analysis (with the Triangular Moving Average being a close cousin), the DWMA gained utility as computing power allowed traders to easily chain indicators. It represents a logical extension of the WMA for traders who found the standard WMA too jittery but appreciated its linear weighting scheme.
1. First, you calculate a standard WMA of the price. This removes high-frequency noise but leaves some jaggedness.
2. Then, you calculate a WMA of that *first* WMA. This polishes the curve, resulting in a very smooth line that clearly defines the underlying trend direction.
Because WMA uses linear weighting (triangle weights), applying it twice creates a weighting structure that resembles a bell curve (Gaussian-like), giving the most weight to the center of the lookback window and tapering off smoothly at both ends.
- **Major Trend:** DWMA is excellent for defining the "background" trend. If price is above DWMA, the bias is bullish.
- **Support/Resistance:** Due to its smoothness, DWMA often acts as dynamic support in uptrends and resistance in downtrends.
#### Crossovers
- **Price Crossover:** Price crossing DWMA signals a major trend change.
- **DWMA/WMA Crossover:** Using a WMA(14) crossing a DWMA(14) creates a signal similar to MACD but directly on the price chart.
### When It Works Best
- **Long-Term Trends:** DWMA filters out the "noise" of daily volatility, letting you stay in a trade during minor pullbacks.
- **Visual Clarity:** It produces a very clean line on the chart, reducing visual clutter.
### When It Struggles
- **Scalping:** The double smoothing introduces too much lag for very short-term trading.
- **Reversals:** DWMA will be slow to recognize a sharp V-bottom or V-top reversal.
## Comparison: DWMA vs WMA vs SMA
| Aspect | WMA | DWMA | SMA |
|--------|-----|------|-----|
| **Lag** | Moderate | High | High |
| **Smoothness** | Moderate | Very High | High |
| **Responsiveness** | Moderate | Low | Low |
| **Weighting** | Linear | Bell-curve-like | Equal |
**Summary:** Use DWMA when smoothness is your priority and you are willing to accept some lag to avoid false signals.
## Architecture Notes
This implementation makes specific trade-offs:
### Choice: Composition
- **Alternative:** Implement a single "Double Weighted" formula.
- **Trade-off:** Slight function call overhead.
- **Rationale:** Reusing the optimized `Wma` class ensures correctness and benefits from any future optimizations to the base WMA (like SIMD).
### Choice: Temporary Buffer for Batch
- **Alternative:** Single pass calculation.
- **Trade-off:** Memory allocation for intermediate results.
- **Rationale:** Calculating DWMA in a single pass is mathematically complex and hard to vectorize. Two optimized WMA passes are faster and easier to maintain.