How WMA Is Calculated (Weighted Moving Average)

WMA calculation formula inputs weights limitations.

Direct answer: what is WMA and how is it calculated?

WMA usually stands for Weighted Moving Average. It is a moving average where more recent observations are given more influence (or, more generally, each observation gets a specified weight). The calculation uses a window of the most recent data points and produces a single averaged value.

The standard discrete formula is:

WMAₜ = ( Σᵢ₌₀^(n−1) [ wᵢ · x₍ₜ−i₎ ] ) / ( Σᵢ₌₀^(n−1) wᵢ )

Where:

  • t is the current index/time step.
  • n is the window length (how many past points are used).
  • x₍ₜ−i₎ are the data values (for example, prices) at times t, t−1, …, t−(n−1).
  • wᵢ are the weights applied to each position in the window.

In many charting conventions, you choose weights so that larger w correspond to more recent points, but the exact weighting direction depends on how you define i.

Mechanics: parameters, inputs, and an example

1) What inputs do you need?

To calculate WMA you need:

  1. A time series: a sequence of values xₜ observed at consistent time intervals.
  2. A window size n: number of most recent points included.
  3. A weight rule: a set of weights w₀ … wₙ₋₁. Weights are often positive, but the general idea is: weights control influence.

A key requirement is that the weights and the mapping to time are clear. For example, you must know whether w₀ is applied to the current value xₜ or the oldest value x₍ₜ−(n−1)₎.

2) What makes WMA different from a simple moving average?

A simple moving average (SMA) treats all points equally (all weights the same). WMA changes the mechanics by letting weights vary across the window.

That means two WMA computations with the same n can still produce different results if you use different weight rules.

3) Worked numerical example (with explicit assumptions)

Assume:

  • Window length n = 3
  • Data values at times t, t−1, t−2 are: xₜ = 10, x₍ₜ−1₎ = 12, x₍ₜ−2₎ = 14
  • Weights increase for more recent points. Using the formula above where w₀ multiplies xₜ, choose weights w₀ = 3, w₁ = 2, w₂ = 1.

Compute the weighted sum:

  • Numerator = (3·xₜ) + (2·x₍ₜ−1₎) + (1·x₍ₜ−2₎)
  • Numerator = (3·10) + (2·12) + (1·14)
  • Numerator = 30 + 24 + 14 = 68

Sum of weights:

  • Denominator = 3 + 2 + 1 = 6

So:

  • WMAₜ = 68 / 6 ≈ 11.33

If you change the weights (for example, make them more extreme), the result moves closer to the most heavily weighted points.

4) Common practical clarification: “average” only works with a denominator

Some implementations effectively normalize weights (divide by total weight). The formula above does this explicitly using Σwᵢ.

If you omit normalization, the result is a weighted sum rather than an average. That distinction matters when comparing WMA values across different window sizes or weight sets.

Limitations and failure modes: what can go wrong

1) Weight choice changes the behavior

WMA is not a fixed “one true calculation.” The window length n and the weight rule wᵢ determine the output.

  • If weights are too concentrated, the WMA may react strongly to short-term noise.
  • If weights are too uniform, it approaches SMA behavior and may lag more.

2) Data frequency and time alignment matter

WMA assumes the sequence is aligned to consistent time steps. If your data includes missing points, irregular sampling, or you accidentally mix different time resolutions, the indices t, t−1, … will no longer represent equal time spacing. That can distort the interpretation of the moving average.

3) Edge effects: the first windows are undefined (or handled differently)

For time t less than n−1, there are not enough past observations to fill the window. Implementations handle this in different ways (for example, outputting no value, using a smaller effective window, or delaying the start). Therefore, to reproduce results, you need to match the same start/initialization convention.

4) Noise, costs, and execution can dominate in real trading contexts

Even though WMA is a deterministic calculation, using it in decision-making can be affected by real-world factors such as transaction costs, data revisions, and how values are sampled/executed. Historical relationships do not automatically imply the future will behave similarly, especially when volatility regimes change.

Verification and next question: how to check your calculation

To independently verify that your WMA calculation is correct:

  1. Write down your chosen n, your weight list wᵢ, and the mapping of each weight to a specific position in time.
  2. Compute the numerator Σ(wᵢ·x₍ₜ−i₎) and the denominator Σwᵢ explicitly.
  3. Confirm that your implementation divides by the total weight (normalization).
  4. Test at least one time step with small, hand-checkable numbers (like the example above) before trusting results on large datasets.

If you want, the next step is to compare how different weighting rules change WMA relative to related averages (for example, simple vs weighted) and to clarify how settings like the window length alter the output.

Trading foreign exchange and CFDs involves substantial risk. Information on FoxiForex is educational and is not personal financial advice. Sponsored placements are labelled clearly.