How it works
The weighted moving average sits between the simple and exponential versions. Like the SMA it uses a fixed window of N bars and forgets everything older completely. Unlike the SMA it does not treat those bars as equals: it assigns weights that decline in a straight line, so the newest bar gets weight N, the one before it N-1, and the oldest gets a weight of 1.
That linear ramp is the whole idea. The decay is steeper at the recent end than an EMA of comparable length, which makes the WMA the quickest of the three classic averages to turn, and its finite window means an old shock leaves the calculation entirely rather than decaying forever. The cost is the usual one: a line that turns quickly also turns wrongly more often, and because the newest bar carries the largest single weight, one violent print drags the line noticeably.
In practice the WMA is used less as a standalone trend line and more as a building block. Its most important role today is inside the Hull moving average, which combines three WMAs of different lengths specifically to cancel lag. It also appears wherever a trader wants an average that responds fast but has a hard cutoff — an intraday line that should reflect this morning and genuinely nothing from last week.
Choosing between the three: use the SMA when stability matters and you can accept being late, the EMA as the general-purpose default, and the WMA when you want the fastest classical line and are prepared to filter its signals with something else. Plot all three at the same length and the WMA will be closest to price at every turn, the SMA furthest, the EMA in between — an ordering that is a property of the weights, not of the market.
Calculation
The arithmetic in words, in the order it happens.
Take the last N source values. Multiply the most recent by N, the next most recent by N-1, and so on down to the oldest, which is multiplied by 1. Add those products and divide by the sum of the weights, N(N+1)/2 — for a 10-period average that divisor is 55. Bars older than N receive a weight of exactly zero and have no influence at all.
Source
An AlgoBeamScript implementation of the formula above, written by us from the arithmetic so the code and the calculation agree line for line.
Runs unchanged on the platform and in the AlgoBeamTS runtime. The language reference is in the documentation.
Inputs
Defaults are the values most charting packages ship with. They are conventions, not optimal settings — the right length depends on your instrument and your holding period.
| Input | Default | What it changes |
|---|---|---|
| Length | 9 | The window size and therefore the top weight. Short settings such as 9 give a line that shadows price closely; lengthening it flattens the weight ramp and pushes the WMA toward the behaviour of a simple average. |
| Source | Close | Price series fed into the weighting. Because the newest bar carries the heaviest weight, a source that includes the high and low noticeably reduces the jumpiness of the line on volatile instruments. |
| Offset | 0 | Time-shifts the plotted line. Cosmetic with respect to the arithmetic; used to keep a reference line clear of the forming bar. |
How to read it
What practitioners take from the plot. Read these as descriptions of market state, not as entry signals.
- WMA turning before the EMA and SMA at the same length
- Expected behaviour rather than a signal in itself. It tells you the most recent bars have moved against the older ones, which is early information that still needs confirmation.
- Price riding above a steeply rising WMA
- Strong, recent-dominated momentum. The steeper the line relative to a same-length SMA, the more the move is concentrated in the last few bars — which also makes it more fragile.
- WMA and SMA of the same length converging
- Recent bars are behaving like the older ones: the advance is even rather than front-loaded, which usually means a trend has settled into a steady pace.
- Sharp WMA turn immediately after one outsized bar
- A weighting artefact rather than a trend change. The newest bar carries the top weight, so a single spike can flip the slope without anything structural having happened.
Limitations
Where this indicator misleads. None of these are fixed by a better parameter.
- The heaviest weight sits on the single most recent bar, so news spikes, bad prints and thin-liquidity wicks all move the line more than they deserve to.
- It lags less than an SMA but it still lags, and in a fast reversal the finite window keeps the old regime voting until it has fully rolled out.
- Being the fastest of the classic averages, crossover systems built on it whipsaw hardest in ranges; it needs a trend filter more than the other two do.
- The linear weight ramp is a convention with no theoretical claim over geometric decay, so results should never be read as evidence that linear weighting is optimal.
Educational reference. This page explains how an indicator is built and how it is commonly read. It is not investment advice, not a recommendation and not a signal service. No indicator is profitable on its own — each is a way of describing a market, and any rule built on one has to be tested with realistic costs before it is traded.