TL;DR. The average of the last n values with weights rising in a straight line: the newest bar counts n times as much as the oldest, so the line follows a turn sooner than an SMA of the same length and stays smoother than price.
What it measures
- Trend with less lag than an SMA. Recent bars carry most of the weight, so a WMA turns a few bars before an SMA of the same period.
- A fixed window. Unlike an EMA, nothing older than n bars counts at all. A spike leaves the average completely once it is n bars old.
- The building block of the Hull average. The Hull Moving Average is built from three weighted averages; a WMA alone is the plain version.
Formula
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Period | 30 | 1 to 500 | Bars averaged. The default is TA-Lib's. |
| Source | Close | Close, Open, High, Low, HL2, HLC3, OHLC4 | Which value of each bar is averaged. HL2 is (high + low) / 2, HLC3 adds the close and divides by 3, OHLC4 averages all four. |
Recommended periods
- 9 to 20 (fast): Intraday entry triggers and the fast line of a crossover pair.
- 30 (default): A balanced trend line on 5 to 15 minute bars.
- 50 to 200 (slow): Regime filters, where the line should move only when the trend does.
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| WMA | Numeric | Always | The weighted average itself, in price units, drawn over the candles. Comparable directly to price and to any other average. |
How to read it
- Price above a rising WMA: recent bars are above their weighted average, and the newest ones most of all. An up state for this period.
- Price below a falling WMA: the mirror, a down state.
- WMA against SMA of the same period: the WMA sits closer to price. When the WMA crosses its SMA twin, the most recent bars have moved away from the window's middle, an early sign of a turn.
- Flattening WMA: the newest bars are no longer pulling the average, so momentum is fading even if price has not reversed yet.
Best in, worst in
Best in trending sessions, where reacting a few bars sooner than an SMA is worth the slightly noisier line.
Worst in tight chop: like every average, a WMA crossed by price over and over makes a crossover rule trade too often. Pair it with a trend filter or wire Re-arm when on the Entry.
Three setups
1. Fast WMA over slow WMA
Add two WMA nodes (for example 20 and 50) and a Crossover node reading them: fast above slow for longs, below for shorts. The Crossover fires once per cross, so the strategy takes one trade per turn without a reset.
2. WMA as a trend filter
Compare price with a WMA(100) and AND it into another indicator's entry. Longs only above the line, shorts only below it. The weighted line lets the filter flip a little sooner than an SMA(100) after a real trend change.
3. Pullback to the WMA
In an uptrend (WMA(50) rising, compared with its own value a few bars ago through a Bars Ago modifier), enter long when price dips to within one ATR of the WMA, with a stop below the line through Set Stop Loss.
Common mistakes
- Expecting a different shape from an EMA. At the same period a WMA and an EMA are close; the difference is that a WMA forgets a bar completely after n bars. Pick by that, not by speed alone.
- Tuning the period too finely. A rule that works at WMA(21) and fails at WMA(20) or WMA(22) has found noise. Sweep a range and look for a plateau (overfitting in trading).
- Forgetting the source. A WMA of HL2 sits between the bar's extremes and crosses the close more often than a WMA of the close does.
A WMA is a fixed window with its weight on the newest bars: earlier than an SMA, and it forgets a bar completely once the bar leaves the window.