Skip to content
Indicators 5 min read

Weighted moving average (WMA): formula and chart use

How a weighted moving average gives linearly larger weights to recent closes, how to calculate it, how it compares with SMA and EMA, and its sideways limits.

Hypothetical daily candles with a 20-session weighted moving average and a dashed 20-session simple moving average through an advance, a decline and a sideways stretch.SidewaysWMA 20SMA 20Closing high
Hypothetical sessions, not market data. After the closing high the WMA turns down four sessions later and the SMA seven sessions later; in the shaded sideways stretch the WMA changes direction more often.

A weighted moving average multiplies the newest close by n, the one before by n − 1, and so on down to 1, then divides by the sum of the weights. It follows price more closely than an SMA of the same length, which also makes it change direction more often in sideways markets.

What the weighted moving average is

A weighted moving average, or WMA, is an average of the last n closes in which recent closes count more. The weights fall in a straight line: the newest close gets weight n, the oldest in the window gets weight 1, and closes before the window get none. The result is a line that sits closer to recent prices than a simple moving average of the same length.

  • Inputs: closing prices.
  • Lookback: n sessions; the first value needs n closes.
  • Units: dollars, like the prices it averages.
  • Cadence: on a daily chart each weight applies to one session.

How to calculate the weighted moving average

Multiply each close in the window by its weight, add the products and divide by the sum of the weights, n(n + 1) / 2. For a 5-session WMA the weights are 1 to 5 and their sum is 15. The first table shows the calculation for session 5 of a hypothetical stock, and the second follows both averages for six sessions.

WMA = (n × Close today + (n − 1) × Close 1 session earlier + … + 1 × Close n − 1 sessions earlier) / (n × (n + 1) / 2)
n
the number of sessions in the window
n × (n + 1) / 2
the sum of the weights: 15 for n = 5 and 210 for n = 20
Weights for a 5-session WMA at session 5
SessionClose ($)WeightClose × weight ($)
130.20130.20
230.60261.20
331.10393.30
431.504126.00
531.805159.00

The products add up to $469.70 and the weights to 15, so the 5-session WMA at session 5 is $31.313, against a simple average of $31.040.

5-session SMA and WMA, hypothetical closes
SessionClose ($)5-session SMA ($)5-session WMA ($)WMA minus SMA ($)
531.8031.04031.313+0.273
631.6031.32031.500+0.180
731.0031.40031.393−0.007
830.5031.28031.093−0.187
930.1031.00030.700−0.300
1029.9030.62030.333−0.287

The closes peak at session 5. The WMA turns down after session 6, one session before the SMA, which keeps rising until session 7.

How much the WMA lags

On a steady straight-line trend, any average of past prices trails the latest price by a fixed number of sessions. For an n-session SMA the delay is (n − 1) / 2 sessions; linear weights cut it to (n − 1) / 3. An EMA with α = 2 / (n + 1) settles at the same delay as the SMA, though it reaches it through weights that never quite end.

Delay behind a steady trend, in sessions
Period nSMAEMAWMA
52.002.001.33
104.504.503.00
209.509.506.33
5024.5024.5016.33

The WMA trails a steady trend by a third less than the SMA, but it still trails. At a turn, each of these averages keeps moving in the old direction for a while.

How to use the weighted moving average on stock charts

A WMA is read like other moving averages: its slope describes the direction of the recent trend, and the position of price relative to it shows where the latest close stands against that trend. Its faster reaction helps when an SMA of the same length feels too slow, and it is the building block of the Hull moving average.

  • Read the slope first. A rising WMA with closes above it describes an advance; a falling one with closes below describes a decline.
  • Compare two lengths. A short WMA crossing a long one shows a change in recent direction, with the same lag trade-offs as any crossover.
  • Pair it with an SMA of the same length to see how much of a move is recent.
  • Keep the period the same when comparing stocks.

Read more in the guides to the Hull moving average and moving averages in chart research.

A stock chart example

The hypothetical chart on this page draws a 20-session WMA and a 20-session SMA over daily candles. After the closing high, the WMA turns down four sessions later and the SMA seven sessions later. In the shaded sideways stretch that follows, the WMA bends with the swings while the SMA stays flatter.

Limitations in sideways markets

The responsiveness that helps in trends works against the WMA in ranges. With no trend to follow, the line turns with each swing and closes cross it often, and many of those crossings reverse within a few sessions. On the hypothetical chart, the WMA changes direction six times in the shaded sideways stretch and the SMA four times.

  • Whipsaws. Crossings of price and WMA come and go quickly in a range.
  • Still a lagging line. A WMA reacts sooner than an SMA, but only after price has moved.
  • Gentle drop-off. The oldest close carries weight 1 out of 210 in a 20-session WMA, so its exit from the window moves the line far less than it would move an SMA.
  • No volume. The weights depend only on position in time, not on how many shares traded.

Weighted averages and TradeClever

TradeClever’s Stock Charts do not draw a WMA. They draw up to three SMA overlays and an EMA overlay, so the closest comparison there is an EMA against an SMA of the same period, which shows the same idea of a faster-reacting average. In CleverScan, EMA(close, 20) and SMA(close, 20) are among the supported forms.

Read our data and methodology notes for calculation context. This guide explains research tools and observations. It does not recommend a trade or investment.

Follow your curiosity

One good question leads to another.

All guides
Make room for better research

Put your curiosity to work.

Build a scan with filters or CleverScan rules. Explore the results. Find your next idea.

Open a stock chart