A weighted moving average (WMA) smooths price data over a rolling window while giving observations different, explicitly specified weights. With linear weighting, newer prices receive greater weight than older prices, making the WMA more responsive than a simple moving average (SMA) and less exponential than an EMA. section 10.2.2
Use WMAs as part of a broader technical-analysis workflow:
- Choose a rolling window, such as 3 or 20 trading days. section 10.2.2
- Compare the WMA with SMA, EMA, or HMA according to the desired balance between responsiveness, smoothness, and lag. section 10.2.2 section 10.4
- Treat faster signals as analytical inputs rather than guarantees; differences between averages can become material in large transactions. section 10.2.2
Computing a WMA in pandas
For a window of n prices, create weights 1 through n, take their dot product with each rolling price window, and divide by the sum of the weights. The final price therefore receives the largest linear weight. A reusable implementation can then add WMA columns alongside SMA, EMA, and HMA columns for historical closing prices.
