03 — Moving Averages

Weighted Moving Average#

Debated1 min read
◆ The PatternA straight-line fade of the past: the newest price counts most, older ones taper off evenly

The Weighted Moving Average assigns linearly increasing weights to more recent prices.

WMA = (N·Cₙ + (N−1)·Cₙ₋₁ + … + 1·C₁) / (N(N+1)/2)

The denominator is the triangle number — the sum of weights 1 + 2 + … + N.

WMA falls between SMA and EMA in responsiveness. Less common in practice than EMA, but useful when you want linear rather than exponential decay of older data.

Worked example

Weights 1 to 5, newest heaviest. Day 15: (1×104 + 2×102 + 3×99 + 4×101 + 5×104) / 15 = 1529 / 15 = 101.93. On day 8, at the end of the rally, it led the SMA by 0.67 (107.47 against 106.80): the heavy weights sit on the latest prices.

The example data: 15 days, used in every indicator here
DayHighLowCloseVolume
11019910050,000
210310010262,000
310310010148,000
410510110470,000
510810410785,000
610810510660,000
711010610990,000
811010710872,000
910810410580,000
1010510210366,000
1110510210455,000
1210410110275,000
13102989995,000
141029910164,000
1510510110471,000
Where it misleads
  • The weights drop to zero at the edge of the window, so a price leaving it still makes the line jump a little.
  • Linear weights are a choice, not a finding — there is no evidence they beat exponential ones. Pick by how quickly you want old data to fade.
  • Like every average, it confirms a turn rather than predicting it.
In code
w = np.arange(1, 6)                      # weights 1..5, newest heaviest
df['wma5'] = df['close'].rolling(5).apply(lambda x: (x * w).sum() / w.sum(), raw=True)
Python, in your browser — edit the code and run it again

Assumes import numpy as np, import pandas as pd, and a DataFrame df with columns high, low, close and volume — the 15 days above.

Sources
  • Trading Systems and Methods (5th ed.), P. J. Kaufman, Wiley, 2013 — the moving-average family compared
  • Technical Analysis of the Financial Markets, J. J. Murphy, New York Institute of Finance, 1999

Last reviewed October 2026 · How this site checks its content · Report a mistake

Pattern bridge: Weighted averages assign importance by position — the same principle behind attention weights in transformers and weighted means in statistics.
Linked from 1
← Previous
Exponential Moving Average
Open in the full reader, with the topic sidebar