Skip to main content
Moving Averages

The Weighted Moving Average: Custom Weight Distribution

Pomegra Learn

The Weighted Moving Average

The Weighted Moving Average (WMA) gives traders explicit control over how much weight each closing price receives in the calculation. Unlike a Simple Moving Average, where all prices carry equal weight, and unlike an Exponential Moving Average, where the weighting is mathematically fixed by the period, a WMA lets you decide: "I want today's close to count twice as much as yesterday's close, and yesterday's to count twice as much as the day before." This flexibility allows traders to fine-tune the moving average to match their specific market dynamics and trading philosophy. The downside is that this flexibility requires understanding how to assign weights thoughtfully. Assign too much weight to recent prices, and you end up with an indicator almost identical to raw price action. Assign weight poorly, and your WMA becomes worse than an SMA or EMA. In this article, we examine the WMA calculation, strategies for choosing weights, and when a WMA is worth the added complexity.

Quick definition: A Weighted Moving Average assigns a custom weight (multiplier) to each closing price in the calculation window, with weights typically increasing toward the most recent prices.

Key takeaways

  • The WMA multiplies each closing price by a weight, sums the weighted prices, and divides by the sum of the weights
  • Weights are usually assigned such that recent prices receive more weight than older prices
  • A common weight scheme is linear: the most recent price gets weight N, the next gets weight N-1, down to weight 1 for the oldest
  • The WMA is more responsive than an SMA but gives the trader full control over exactly how responsive
  • WMA is less commonly used than SMA or EMA in retail trading, but some professionals prefer it for specific strategies

The Weighted Moving Average formula

The WMA calculation follows this structure:

WMA = (Sum of each price × its assigned weight) / (Sum of all weights)

Let us work through a concrete example using linear weighting. Suppose you want a 5-period WMA with linear weights (5, 4, 3, 2, 1), where the most recent price gets the highest weight.

Closing prices (oldest to newest):

  • Day 1: $100.00 (weight = 1)
  • Day 2: $101.00 (weight = 2)
  • Day 3: $100.50 (weight = 3)
  • Day 4: $102.00 (weight = 4)
  • Day 5: $103.00 (weight = 5)

Step 1: Multiply each price by its weight.

  • ($100.00 × 1) = $100.00
  • ($101.00 × 2) = $202.00
  • ($100.50 × 3) = $301.50
  • ($102.00 × 4) = $408.00
  • ($103.00 × 5) = $515.00

Sum of weighted prices = $100.00 + $202.00 + $301.50 + $408.00 + $515.00 = $1,526.50

Step 2: Sum the weights.

1 + 2 + 3 + 4 + 5 = 15

Step 3: Divide the weighted sum by the sum of weights.

WMA = $1,526.50 / 15 = $101.77

Compare this to what a 5-period SMA would give you: ($100.00 + $101.00 + $100.50 + $102.00 + $103.00) / 5 = $101.30. The WMA ($101.77) is higher because the most recent prices ($102.00 and $103.00), which are above the average, carry more weight. The oldest price ($100.00), which is below the average, carries minimal weight.

Linear weighting: the simplest approach

The example above uses linear weighting, where weights increase in a straight line from 1 to N. This is the most transparent and commonly recommended weighting scheme for a beginner learning WMA. Linear weighting is intuitive: "I want recent prices to count a bit more, but not radically more."

On a 20-period WMA with linear weights, the most recent price receives weight 20, the prior one receives 19, and so on back to weight 1 for the price from 20 bars ago. This is more responsive than a 20-period SMA (where all prices carry weight 1) but much less responsive than a 20-period EMA (where the mathematical exponential weighting is quite aggressive on recent prices).

Linear weighting strikes a middle ground that many traders find attractive. The calculation is simple to understand and verify, yet it provides a meaningful responsiveness improvement over the SMA.

Comparing the three main moving averages

Let us place the SMA, EMA, and WMA side by side on the same data. Using the 5-period window from our earlier example:

  • 5-period SMA: $101.30 (all prices weighted equally)
  • 5-period WMA (linear): $101.77 (recent prices weighted higher)
  • 5-period EMA: $101.60 (approximately, using exponential weighting)

The WMA and EMA are close in this case, but they weight prices differently. The EMA gives even more emphasis to the most recent close ($103.00) through its exponential formula, while the WMA gives a fixed additional weight to it. Over longer periods and across different market conditions, these differences compound, and traders may find one suits their style better than another.

Choosing a weighting scheme

Beyond linear weighting, traders can experiment with other schemes:

Quadratic weighting: Weights increase in squares (1, 4, 9, 16, 25). This gives much more emphasis to recent prices than linear weighting. Use this if you want faster responsiveness but still want transparency and trader control.

Harmonic weighting: Weights based on the harmonic series (1, 1/2, 1/3, 1/4, 1/5). This distributes weight more evenly across the period, less aggressively favoring recent prices.

Custom weighting: Assign weights based on your specific belief about the market. For example, if you want to emphasize only the last 3 days and ignore everything before that, weight them as (0, 0, 0, 0, 5, 4, 3, 2, 1) over a 9-bar period. Custom weighting allows traders to encode specific strategies.

The key principle is that you choose weights that match your market perspective. If you believe recent price action is highly predictive, use aggressive weighting. If you believe the market should be viewed with longer memory, use gentle weighting.

Real-world example: Apple stock (AAPL) with WMA

On December 29, 2023, Apple closed at $189.95. Over the next 5 trading days, the closing prices were:

  • Day 1: $189.95
  • Day 2: $190.25
  • Day 3: $191.35
  • Day 4: $188.63
  • Day 5: $192.53

The 5-period SMA = ($189.95 + $190.25 + $191.35 + $188.63 + $192.53) / 5 = $190.54

The 5-period linear WMA (weights 1, 2, 3, 4, 5): = ($189.95 × 1 + $190.25 × 2 + $191.35 × 3 + $188.63 × 4 + $192.53 × 5) / 15 = ($189.95 + $380.50 + $574.05 + $754.52 + $962.65) / 15 = $2,861.67 / 15 = $190.78

The WMA is slightly higher ($190.78 vs. $190.54) because the most recent close ($192.53) is above the mean, and it receives the highest weight. If the stock had closed lower on day 5, the WMA would be lower than the SMA.

A trader using a 5-period WMA on Apple over this period would have a moving average that more closely reflected the recent strength (day 5's close of $192.53) compared to the SMA, which equally weighted all five days. In a strong trend, this responsiveness can mean faster entry signals and earlier exits.

Advantages and disadvantages of the Weighted Moving Average

Advantages:

  • Puts weights where the trader believes they belong; full transparency and control
  • More responsive than SMA but with explicit control (unlike EMA's fixed exponential weighting)
  • Can be tailored to specific strategies or market conditions
  • Calculation is straightforward and easy to verify
  • Filters noise while remaining responsive to recent changes

Disadvantages:

  • Requires choosing a weighting scheme, adding subjectivity and complexity
  • Less standardized than SMA or EMA; traders looking at the same chart may use different weights
  • No consensus on "the best" weighting scheme, so traders must test and validate their choice
  • More difficult to explain to non-technical traders ("Why does this price get weight 4 and not weight 3?")
  • Still a lagging indicator; the lag is less than SMA but more than an EMA with the same period

When to use a Weighted Moving Average

WMA is most useful when:

  1. You have a specific hypothesis about recent price importance. If you believe the last 3 days are far more predictive than the 20 days before that, use a weighting scheme that reflects this.
  2. You are refining an existing SMA or EMA strategy. If a moving average strategy nearly works but enters or exits slightly too late, a WMA with tuned weights might improve the timing.
  3. You are building a custom algorithm. Algorithmic traders often use WMA because they can code in any weighting scheme and backtest it systematically.
  4. You want more responsiveness than SMA but more stability than EMA. Quadratic linear weighting gives you middle ground with explicit control.

WMA is probably not necessary for:

  1. Beginners learning technical analysis. Master the SMA and EMA first; WMA adds complexity without guaranteed benefit until you understand the fundamentals.
  2. One-off trading decisions. If you are examining a chart to decide whether to hold a position, an SMA or EMA will give you the answer just as well as a WMA.
  3. Crowded markets where consensus matters. If most other traders are watching the 50-day SMA or EMA, ignoring the consensus to use a WMA may hurt more than help.

Building your own Weighted Moving Average

If you use trading software like TradingView, MetaTrader, or Thinkorswim, most platforms allow you to create a custom weighted moving average or to adjust the weighting scheme. The process typically involves:

  1. Specifying the period (e.g., 20 days)
  2. Specifying the weighting method (linear, quadratic, or custom)
  3. Plotting the result on your chart
  4. Comparing it to SMA and EMA versions with the same period
  5. Back-testing it on historical data to see if it improves your entry/exit timing

After testing, if you find that a 20-period linear WMA improves your trading results compared to a 20-period SMA or EMA, use it consistently. If the improvement is marginal, stick with the simpler SMA or EMA to reduce cognitive load while trading.

Common mistakes with Weighted Moving Averages

Over-optimizing weights to past data. You design a weighting scheme that worked perfectly on the last 3 years of data, then it fails in new market conditions. Test out-of-sample when possible.

Using WMA when SMA suffices. If a 50-day SMA is giving you perfect entry and exit signals, adding complexity by switching to a WMA may not help.

Neglecting to document your weighting rationale. If you later cannot remember why you weighted day 5 as 10 and day 4 as 8, you cannot explain your strategy to partners or adjust it intelligently.

Assuming more recent prices are always more important. In some markets, prices from N days ago may be more predictive than today's price. Test this assumption rather than assuming it.

Using a WMA on different time frames without testing each. A linear WMA that works on daily charts may not work on hourly charts because the market structure is different.

FAQ

Q: Should I use a weighted moving average instead of an SMA or EMA? A: Only if you have tested a specific weighting scheme on your market and it demonstrably improves your results. SMA and EMA are sufficient for most traders.

Q: What is the best weighting scheme? A: The best is the one that works on your market with historical data. Linear weighting (1, 2, 3, ..., N) is the simplest starting point. Test quadratic weighting if you need more responsiveness.

Q: Can I apply quadratic weighting to a 20-period WMA? A: Yes. Weights would be (1, 4, 9, 16, 25, ..., 400) for bars 1 through 20. The most recent bar would have enormous influence; test it to ensure it fits your strategy.

Q: Is WMA harder to calculate than SMA or EMA? A: Conceptually, it is straightforward: multiply, sum, divide. In practice, charting software handles all three equally well. Difficulty is not the issue; justifying the extra complexity is.

Q: Do professional traders use weighted moving averages? A: Some do, especially algorithmic traders and those with specific market beliefs about recent-data importance. But most professionals stick with SMA or EMA due to standardization and simplicity.

Q: Can I combine WMA and EMA on the same chart? A: Yes. Some traders use a linear WMA as a primary trend indicator and an EMA as a secondary confirmation or faster entry signal.

Q: Does WMA work on all asset classes? A: Yes, the mathematics apply to any price series: stocks, bonds, currencies, commodities, crypto. The weighting scheme choice may differ by asset class based on historical volatility and trends.

Summary

The Weighted Moving Average provides traders with explicit control over which closing prices receive emphasis in the calculation. Using linear, quadratic, or custom weighting, you can fine-tune the moving average's responsiveness to match your market beliefs and trading strategy. While more complex than SMA or EMA, the WMA offers valuable flexibility for traders with specific hypotheses about the predictive power of recent versus historical prices. Test any weighting scheme thoroughly on your market before deploying it in live trading.

Next steps

Choosing a Moving Average Period: Learn how to select the optimal time window for your moving average based on your market and trading style.