文章

Weighted Moving Average (WMA): Formula, Examples, Forecasting and Trading Uses

A weighted moving average (WMA) is a rolling average that gives different levels of influence to the observations in its window by multiplying each value by an assigned weight. WMA is calculated by adding the weighted values and dividing by the total weight. In trading, WMA often means a linear WMA, where the newest price receives the largest weight.

A WMA reacts most strongly to the observations with the largest weights, but the WMA still uses historical data and remains a lagging measure. Forecasting methods may use custom weights, while many trading platforms use the fixed linear sequence 1, 2, ..., n. The calculation method therefore needs to be identified before two WMA values can be compared.

A linear WMA gives the newest value the largest positional weight while retaining every value in the selected window.

What Is a Weighted Moving Average?

A weighted moving average is a rolling average in which each observation is multiplied by a specified weight, so some observations influence the result more than others. The rolling window defines which observations are included, while the weights define how much each included observation contributes.

Greater weight is commonly assigned to newer observations because recent values may better represent the current level of a time series. Recency weighting is a method choice, not a mathematical requirement: a custom WMA can use any justified non-zero weighting pattern, provided the calculation applies the intended weights consistently and divides by their total.

Each WMA value represents one window. When the time series advances, the oldest observation leaves the window, the newest observation enters, and positional weights are assigned again. That rolling update distinguishes a moving average from a one-time weighted average.

The resulting WMA stays in the same unit as the source observations: price inputs produce a price-based WMA, while demand inputs produce a demand-based WMA. The weights change influence, not the meaning or unit of the underlying series.

Is WMA the Same as a Linear Weighted Moving Average?

WMA and linear weighted moving average are often used as equivalent terms in trading, but the two terms are not universally identical. A linear weighted moving average assigns weights in an arithmetic sequence, normally 1 to the oldest observation, 2 to the next observation, and n to the newest observation.

A general WMA may instead use custom weights such as 0.20, 0.30 and 0.50. Forecasting models often use these custom weights to represent a business assumption or a weight set tested against forecast error. Many charting platforms use WMA to mean the linear version, so the platform specification, period, price source and oldest-to-newest weight order should be checked before a value is reproduced.

The distinction matters because two methods can use the same three observations but produce different results when their weights differ. Once the WMA type is known, the formula makes the relationship between each value and its weight explicit.

What Is the Weighted Moving Average Formula?

WMA equals the sum of each value multiplied by its weight, divided by the sum of all weights. For n ordered observations, the general formula is:

WMA = (w1 × x1 + w2 × x2 + ... + wn × xn) / (w1 + w2 + ... + wn)

In the formula, x is an observed value, w is the weight paired with that value, and n is the number of observations in the window. The numerator is the weighted sum, while the denominator normalises the result by the total weight.

For a linear WMA with weights 1 through n, the formula can be written as:

Linear WMA = (1 × x_oldest + 2 × x_next + ... + n × x_newest) / [n × (n + 1) / 2]

The denominator n × (n + 1) / 2 is the triangular number that equals 1 + 2 + ... + n. A three-period linear WMA therefore divides by 6, while a four-period linear WMA divides by 10.

The general formula accepts any valid weights; the linear formula uses weights 1 through n.

Why Do the Weights Need to Be Normalised?

Weights need to be normalised so the WMA remains on the same scale as the observations. Dividing by the total weight converts the weighted sum into an average instead of leaving the result as an unscaled total.

Raw weights 1, 2 and 3 have a total of 6. Their normalised equivalents are 1/6, 2/6 and 3/6, which total 1. Both forms produce the same result:

(10 × 1 + 12 × 2 + 15 × 3) / 6 = 13.17

(10 × 1/6) + (12 × 2/6) + (15 × 3/6) = 13.17

The division by SUM(weights) can be omitted only when the supplied weights already total 1, or 100%. Omitting the division when raw weights total more than 1 produces a weighted sum, not a weighted moving average. Normalisation also shows why the linear denominator is 6 for a three-period WMA: 6 is simply the sum of the positional weights.

How Do You Calculate a Weighted Moving Average?

Choose the window, assign weights, multiply each value by its matching weight, add the products and divide by the total weight. The oldest-to-newest direction must remain consistent through every step.

1. Select the number of periods in the rolling window.

2. Arrange the observations from oldest to newest.

3. Assign each observation its intended weight.

4. Multiply every observation by its matching weight and add the products.

5. Divide the weighted sum by the sum of the weights.

For a linear WMA, the newest observation receives the largest positional weight. For a custom WMA, the weight order follows the documented model rather than an assumed sequence. The five-step method is complete only when the next time period advances the window and repeats the calculation.

WMA calculation follows five auditable steps.

Three-Period Weighted Moving Average Example

A three-period linear WMA for the values 10, 12 and 15 is 13.17 when the oldest-to-newest weights are 1, 2 and 3. The newest value, 15, contributes the most because the newest value receives the largest weight.

Table: Three-period linear WMA using oldest-to-newest weights 1, 2 and 3.

   
OrderValueWeightWeighted value
Oldest10110
Middle12224
Newest15345
Total37679

The arithmetic is:

Three-period WMA = (10 × 1 + 12 × 2 + 15 × 3) / (1 + 2 + 3) Three-period WMA = 79 / 6 Three-period WMA = 13.17

The WMA of 13.17 is higher than the unweighted average of 12.33 for the same three rising values because the linear WMA gives more influence to the higher, newer observations. That relationship can reverse when recent observations fall, so the result should not be interpreted as a fixed advantage over an equal-weight average.

Two checks make the example auditable. First, the weighted products must total 79 and the weights must total 6. Second, a WMA calculated with non-negative weights should remain between the smallest and largest observations in the window, so 13.17 should fall between 10 and 15. The final value should be rounded only after dividing 79 by 6; rounding each product or weight early can alter a longer calculation.

The weight order has a visible effect. If the same values were incorrectly weighted 3, 2 and 1 from oldest to newest, the result would be 11.50 rather than 13.17. The difference is caused entirely by which observation receives the largest influence.

How the Window Moves to the Next Period

The WMA moves to the next period by removing the oldest observation, adding the newest observation and reassigning the positional weights within the new window. Adding a fourth value of 18 changes the three-period window from 10, 12, 15 to 12, 15, 18.

Table: Consecutive three-period WMA windows using the same positional weights.

   
WMA outputOldest × 1Middle × 2Newest × 3Weighted sumWMA
Period 31024457913.17
Period 41230549616.00

The weight 3 does not remain attached to the value 15. The weight 3 moves to the newest position, which is occupied by 18 in the second window. Reversing the sequence would describe a different model because the oldest observation would receive the largest influence.

For an n-period WMA, the first n - 1 rows do not contain enough observations to form a complete window. A three-period WMA therefore has no full-window output for periods 1 and 2; the first valid WMA appears at period 3. Charting software may display these initial rows as blank, omit them or use a platform-specific warm-up method.

A moving average is a series: each new period advances the window and reassigns positional weights.

Repeating that arithmetic manually becomes inefficient as the series grows, which makes the spreadsheet implementation the next practical step.

How Do You Calculate WMA in Excel?

Use =SUMPRODUCT(value_range,weight_range)/SUM(weight_range) and keep the value and weight ranges the same size and order. SUMPRODUCT multiplies each value by its paired weight and adds the products, while SUM provides the normalising denominator.

For values 10, 12 and 15 in cells A2:A4 and raw weights 1, 2 and 3 in cells D2:D4, enter:

=SUMPRODUCT(A2:A4,$D$2:$D$4)/SUM($D$2:$D$4)

The dollar signs keep the weight range fixed when the formula is filled down. In the next output row, the value range should move from A2:A4 to A3:A5 while the weight range remains D2:D4. The value and weight ranges must contain the same number of cells and use the same oldest-to-newest order.

The first two output cells for a three-period WMA should remain blank because no complete three-value window exists. A production worksheet can handle those rows with a blank-cell check, but the calculation should not silently substitute a shorter window unless the method explicitly allows one.


Use equal-sized, identically ordered value and weight ranges; divide by SUM(weights) unless weights total 1.

Excel Formula for Linear and Custom Weights

The Excel formula for linear and custom WMA uses the same SUMPRODUCT structure; only the weight range changes. Linear weights for a three-period WMA are 1, 2 and 3, while a custom model might use 0.20, 0.30 and 0.50.

Use the following formula when the weight range contains raw weights that do not necessarily total 1:

=SUMPRODUCT(A2:A4,$D$2:$D$4)/SUM($D$2:$D$4)

Use the following shorter formula only when the weight range has been checked and totals exactly 1:

=SUMPRODUCT(A2:A4,$F$2:$F$4)

The raw linear weights 1, 2 and 3 and the normalised weights 1/6, 2/6 and 3/6 return the same WMA. A spreadsheet should still display the weight total so a reversed range, omitted cell or percentage-entry error can be detected.

The calculation is shared, but forecasting and trading answer different questions and require different validation.

The automated output can now serve two separate applications: a next-period forecast or a plotted trading indicator. Each application needs its own interpretation and evaluation method.

How Is WMA Used for Forecasting?

In forecasting, a trailing WMA uses weighted recent observations as the estimate for the next period, usually for a short horizon. The forecast assumes that the selected window and weighting pattern contain useful information about the next observation.

A WMA forecast is most straightforward for a relatively level series where recent history remains relevant. Trend, seasonality, structural breaks and changing demand patterns can make a fixed weight set unreliable, so the weight set and forecast horizon need to be tested against later observations.

The calculation does not change when WMA is used for forecasting. The interpretation changes: the WMA output is assigned to the next period as an estimate rather than plotted only as a smoothed historical line.

Three-Month Weighted Moving Average Forecast Example

A three-month WMA forecast multiplies each of the three most recent monthly observations by its assigned weight and uses their sum as the one-step-ahead forecast when the weights total 1. Using monthly demand values of 10, 12 and 15 units with weights 0.20, 0.30 and 0.50 produces a Month 4 forecast of 13.10 units.

Table: One-step-ahead three-month demand forecast with weights totalling 1.

   
Source monthDemandWeightWeighted demand
Month 1, oldest100.202.00
Month 2120.303.60
Month 3, newest150.507.50
Total / Month 4 forecast
1.0013.10

The formula is:

Month 4 forecast = (10 × 0.20) + (12 × 0.30) + (15 × 0.50)

Month 4 forecast = 13.10 units

The 13.10-unit result is a one-step-ahead forecast, not a forecast for every future month. A recursive Month 5 forecast would have to include the Month 4 forecast as though it were an observed value when the actual Month 4 demand is unavailable. Each additional recursive step therefore depends partly on earlier forecasts, which can compound error and flatten or distort the projected path.

The decimal weights total 1, so no additional division is required. Raw weights 2, 3 and 5 would produce the same 13.10-unit forecast after division by 10. The forecast is also lower than the latest demand of 15 units because the two earlier, lower observations still contribute half of the total weight.

How Should You Choose and Test Forecast Weights?

Forecast weights should be chosen from a documented rationale and tested against a predefined error metric on periods that were not used to tune the weights. A larger recent weight is defensible only when the recent observations improve the forecast for the intended horizon.

A practical validation process is:

1. Define the forecast horizon and the decision the forecast will support.

2. Reserve later observations as a validation or holdout period.

3. Specify candidate weight sets that meet the model constraints, such as non-negative weights totalling 1.

4. Generate forecasts using each candidate set without changing the evaluation period.

5. Compare the errors with a predefined measure such as mean absolute error (MAE) or mean squared error (MSE).

6. Review whether the selected weights remain stable across different validation periods and market or demand conditions.

MAE reports the average absolute size of the errors, while MSE gives larger errors more influence by squaring them. Neither metric makes a weight set universally best; the preferred metric depends on the cost of different error sizes. Optimising weights on the same observations used to judge the model can overfit historical noise, so the final evaluation should use unseen periods.

Forecasting evaluates WMA against realised future observations. Trading uses the same mathematical output differently by comparing a plotted WMA with price or another average.

How Is WMA Used as a Trading Indicator?

As a trading indicator, WMA plots a weighted average of recent prices to describe trend direction and react more strongly to recent price changes than an equal-weight SMA of the same period. Traders can compare the WMA's slope, current price and other moving averages, but the WMA does not provide predictive certainty.

A rising WMA indicates that the weighted recent price baseline is increasing, while a falling WMA indicates that the weighted baseline is decreasing. Price above or below the WMA describes the relationship between the current market and that baseline; the relationship is an observation, not evidence that the next price move must continue in the same direction.

WMA remains lagging because every WMA value is calculated from current and earlier prices. Greater emphasis on newer prices can reduce some delay relative to an equal-period SMA, but increased responsiveness can also make the WMA react to short-lived price changes.

Trend Direction, Price Crossovers and WMA Crossovers

A WMA crossover occurs when price crosses a WMA or when a shorter-period WMA crosses a longer-period WMA. A price/WMA crossover compares the current price with one weighted baseline, while a two-WMA crossover compares a faster baseline with a slower baseline.

Table: Direct interpretation and required caution for common WMA observations.

   
ObservationDirect interpretationRequired caution
WMA slopes upwardThe weighted recent price baseline is rising.The slope can flatten or reverse after a short-lived move.
Price crosses above WMACurrent price has moved above the weighted baseline.One cross does not establish a durable trend.
Short WMA crosses above long WMAThe shorter weighted baseline has risen above the longer baseline.Both averages lag price and can cross repeatedly in a range.
Price crosses back and forthThe market is moving around the weighted baseline.Repeated crossings can create whipsaw if treated as automatic entries.

A crossover rule therefore needs separate testing with stated periods, price inputs, transaction-cost assumptions and risk controls. A chart can illustrate where a cross occurred, but only a defined test can evaluate whether the rule was useful for a particular market and timeframe.

WMA Periods, Price Source and Market Conditions

WMA behaviour depends on the period length, input price, chart timeframe and market conditions. A shorter period uses fewer observations and normally reacts more quickly, while a longer period smooths more price variation and normally responds more slowly.

The input may be the closing price or another platform-supported price source. Two charts labelled “20-period WMA” can differ if one uses closing prices and the other uses a different input, or if the platforms use different WMA definitions. The timeframe also changes what one period represents: 20 observations on a five-minute chart do not describe the same horizon as 20 observations on a daily chart.

Trending conditions may create a persistent slope and fewer baseline crossings, while choppy conditions can move price repeatedly around the WMA. No period is universally best. Periods and inputs should be selected for the analysis objective and tested on the relevant instrument, timeframe and market regime.

The effect of those settings becomes clearer when WMA is compared with other moving-average and volume-weighted methods.

WMA vs SMA, EMA, VWMA and VWAP

WMA weights observations by a chosen sequence, SMA weights them equally, EMA uses exponential decay, and VWMA and VWAP use volume rather than recency as the primary weight. The methods are not interchangeable because each method answers a different weighting question.

Table: Moving-average and volume-weighted methods compared by weighting basis and scope.

   
MethodPrimary weighting basisWindow or memoryTypical outputMain distinction
WMAChosen linear or custom weightsUsually a finite rolling windowWeighted time-series averageGives specified observations more influence.
SMAEqual weight for every observationFinite rolling windowEqual-weight time-series averageProvides the simplest finite-window baseline.
EMAExponentially declining weightRecursive calculation with diminishing historical influenceExponentially smoothed seriesRetains declining influence from earlier values.
VWMATrading volume applied to price observationsDefined rolling windowVolume-weighted moving price averageGives high-volume observations more influence.
VWAPTrading volume applied to price, commonly accumulated within a sessionCommonly session-based or cumulativeVolume-weighted average transaction priceMeasures average traded price by volume over the defined scope.

 For the same three-period rising series, 10, 12, 15 and then 18, the methods can be compared with every parameter disclosed. The three-period SMA and linear WMA first appear at Period 3. A three-period EMA uses alpha = 2 / (3 + 1) = 0.5 and is seeded with the Period 3 SMA.

Table: SMA, linear WMA and EMA calculated on the same four-value series.

   
PeriodPrice3-period SMA3-period linear WMA3-period EMA
110---
212---
31512.3313.1712.33
41815.0016.0015.17

The three averages differ because their weighting rules differ; responsiveness depends on the data and parameters.

The WMA is highest at Period 4 in this rising example because the newest and highest price receives the greatest linear weight. That order is not permanent: a falling new value can pull the WMA down more sharply, and different EMA parameters can change the comparison. The appropriate method therefore follows the required weighting basis, memory and use rather than a universal “better” label.

Advantages and Limitations of WMA

WMA can respond sooner than an equal-period SMA, but greater emphasis on recent observations can also increase sensitivity to noise and does not remove lag. Every WMA advantage depends on the corresponding implementation or interpretation cost.

Table: Paired WMA benefits and limitations.

   
Potential advantageCorresponding limitation
Greater influence for recent observations can make the WMA reflect a new move sooner than an equal-period SMA.Short-lived changes also receive greater influence and can produce more reversals or whipsaw.
Custom weights can represent a documented forecasting assumption.Subjective or overfitted weights can perform poorly outside the tuning period.
Smoothing reduces some period-to-period variation in the raw series.Smoothing still delays turning points because the WMA uses historical observations.
The arithmetic is transparent and can be reproduced by hand or in a spreadsheet.Reversed weights, misaligned ranges or missing normalisation can produce a different result without an obvious error message.
A finite window limits the calculation to a defined recent history.An observation loses all influence when it leaves the window, which can create a discrete change.

WMA is useful when unequal influence is justified and the resulting trade-off is acceptable for the decision. WMA is weak when the weight pattern is arbitrary, the series changes regime, or the output is treated as proof of a future outcome. The limitations explain why correct implementation and validation matter as much as the formula.

Common Weighted Moving Average Mistakes

The most common WMA mistakes are reversing the weight order, omitting normalisation, misaligning spreadsheet ranges and treating a weighted historical average as certainty about the future. Each error changes either the calculation or the meaning of the result.

Reversing oldest and newest weights: Confirm whether the newest observation should receive the largest weight before calculating the first window.

Omitting the denominator: Divide by SUM(weights) unless the weights have already been normalised to total 1.

Using unequal value and weight ranges: Pair one weight with every observation and keep the ranges in the same order.

Keeping weights attached to values: Reassign positional weights after the rolling window advances; the largest linear weight belongs to the newest position.

Filling initial rows with partial-window values: Leave the first n - 1 full-window outputs blank unless a documented warm-up method is used.

Comparing methods with different assumptions: Disclose period, price source, weight sequence, EMA seed and volume scope before comparing outputs.

Treating a forecast as certainty: Evaluate forecast error on later observations and state the forecast horizon.

Treating a crossover as an automatic trade: Test the complete rule, including costs, risk controls and choppy-market behaviour.

Optimising on the evaluation period: Keep a holdout period so forecast or trading parameters are judged on observations not used for tuning.

Correct WMA use therefore depends on a transparent weight definition, an auditable calculation and an evaluation method matched to the application.

Put Simple Weighted Moving Average Analysis Into Practice

TMGM MetaTrader platforms let traders configure the Weighted Moving Average (WMA) by period, applied price, and timeframe. Use consistent settings to identify clear trend directions, test your observations against real price structure, and always define your risk before acting.

Ready to put your WMA strategy to the test? Open a live account to start your CFD trading journey today, or open a demo account to practice risk-free.

今日更明智地進行交易

10,000 美元演示資金
100多個市場
低費用,低點差
Trading App
A group of expert analyst with strengths in fundamental and technical analysis, and years of experience in the Global Equity Markets, Forex, Precious Metals, Oils and other commodities, as well as Crypto, and so on.
加入超過100萬客戶,使用我們屢獲殊榮的交易平台
1
申請真實
賬戶
2
為您的
賬戶注資
3
立即開始
交易
立即註冊