WMA (Weighted Moving Average)
WMA (Weighted Moving Average)
What is WMA?
The Weighted Moving Average (WMA) assigns linearly decreasing weights to each price in the lookback window. The most recent price gets the highest weight (N), the second most recent gets (N-1), and so on down to 1. This makes WMA more responsive to recent prices than SMA while using a simple, transparent weighting scheme.
How it works
WMA(N) = (N × Close_1 + (N-1) × Close_2 + ... + 1 × Close_N) / (N × (N+1) / 2)
The denominator is the sum of weights: N + (N-1) + ... + 1 = N(N+1)/2.
Weight distribution example
For a 5-period WMA on closing prices [100, 102, 101, 103, 104]:
- Most recent (104) gets weight 5
- Previous (103) gets weight 4
- Previous (101) gets weight 3
- Previous (102) gets weight 2
- Oldest (100) gets weight 1
Calculation: (5×104 + 4×103 + 3×101 + 2×102 + 1×100) / (5+4+3+2+1) = 2,090 / 15 = 139.33
The linearity of this weighting ensures recent price action has clear influence without the exponential tail-off seen in EMA.
Key features
- Linear weighting — newest bar weight = N, oldest = 1. Easy to understand and interpret.
- Between SMA and EMA in responsiveness — faster than SMA, comparable to EMA.
- No exponential decay — older bars still have meaningful weight, unlike EMA where weight drops exponentially.
- Used in HMA — the Hull Moving Average is built from WMA combinations.
- Predictable lag reduction — lag decreases by approximately one-third compared to SMA of the same period.
How WMA works in StratBase.ai
In StratBase.ai, WMA is available as a built-in indicator for all chart timeframes. You can apply it to any price series (close, open, high, low, typical price, or custom calculations). The indicator automatically calculates all weights and handles historical data lookback without manual formula entry.
When you add WMA to your strategy:
- The indicator loads the specified period of historical candles
- It calculates weights for each bar automatically
- Values update in real-time as new candles form
- The WMA line plots on your chart and becomes available for condition logic
WMA syncs with your strategy's timeframe. On a 15-minute chart, a WMA(20) uses the last 20 fifteen-minute candles. On a 1-hour chart, it uses the last 20 one-hour candles.
Step-by-step usage instructions
Adding WMA to your chart
- Open your strategy editor in StratBase.ai
- Navigate to the Indicators section
- Search for "WMA" in the indicator library
- Click to add WMA to your chart
- Set your desired period (default is 20)
- Click apply — the WMA line appears on your chart
Using WMA in strategy conditions
WMA becomes available immediately in your condition builder:
Trend identification:
- Select
close > WMA(20)to detect when price is above the moving average - Select
close < WMA(20)to detect when price is below the moving average
Crossover signals:
- Use
WMA(10) cross_over WMA(20)for fast/slow WMA crossovers - Use
WMA(20) cross_under WMA(50)for bearish WMA confirmations
Combined conditions:
- Build multi-leg rules like:
close > WMA(20) AND WMA(10) cross_over WMA(20)for trend + momentum confirmation
Practical workflow example
Suppose you want to build a mean-reversion strategy:
- Add WMA(50) to identify the primary trend
- Add WMA(10) to identify short-term momentum shifts
- Create entry condition:
close cross_under WMA(10) AND close > WMA(50)— price dips below fast WMA but remains above the 50-period support - Add exit condition:
close > WMA(10)— price recovers above fast WMA - Test on historical data to see how many signals trigger and profitability
Practical example with real values
Consider EUR/USD on a 1-hour chart during a trending session:
Setup:
- WMA(20) period = 20 one-hour candles
- WMA(50) period = 50 one-hour candles
- Current price: 1.0850
- WMA(20) value: 1.0835
- WMA(50) value: 1.0820
Signal interpretation:
- Price (1.0850) > WMA(20) (1.0835) > WMA(50) (1.0820) = strong bullish alignment
- This three-line stack suggests sustained uptrend
- A cross below WMA(20) would be first warning sign
- A break below WMA(50) would indicate trend reversal
Entry condition example:
close > WMA(20) AND WMA(20) > WMA(50) AND WMA(10) cross_over WMA(20)
This fires when:
- Price is above the 20-period WMA (uptrend)
- 20-period WMA is above 50-period WMA (confirmed trend)
- 10-period WMA just crossed above 20-period WMA (momentum acceleration)
In this scenario on a 1-hour chart, you'd get approximately 2-4 such signals per trending day, with an average holding time of 3-8 hours.
Parameters
| Parameter | Default | Range | Description | |-----------|---------|-------|-------------| | Period | 20 | 2–500 | Number of candles in the lookback window | | Source | Close | OHLC | Price series to apply WMA (usually close, sometimes typical price) |
Example conditions
| Condition | Meaning |
|-----------|---------|
| close > WMA(20) | Price above 20-period WMA |
| WMA(10) cross_over WMA(30) | Fast WMA crosses above slow — bullish |
| close cross_under WMA(50) | Price breaks below WMA — bearish |
| WMA(20) > WMA(50) | Medium-term uptrend relative to long-term |
| close > WMA(10) AND WMA(10) > WMA(20) | Nested trend confirmation |
Tips
- WMA vs. SMA: Use WMA when SMA feels too slow in choppy markets. WMA reacts faster to recent price action while remaining less prone to whipsaws than EMA.
- WMA vs. EMA: In trending markets, WMA and EMA(same period) produce very similar signals. Choose WMA if you prefer transparency in weighting; choose EMA if you want stronger emphasis on the most recent bar.
- Combine multiple WMAs: Use WMA(10) + WMA(20) + WMA(50) for a three-tier trend filter. Price above all three = strong uptrend; below all three = strong downtrend.
- Compare to support/resistance: Plot WMA(50) or WMA(100) alongside price to identify dynamic support and resistance zones that adapt to market conditions.
- HMA alternative: If WMA feels slightly lagged even with shorter periods, consider Hull Moving Average (HMA) which reduces lag further while maintaining smoothness.
- Standard periods: 10 for short-term scalping, 20 for intraday, 50 for swing trades, 100+ for longer-term positioning.
Common mistakes to avoid
- Period too long: Using WMA(200) on a 5-minute chart removes all short-term signal value. Match period to your intended timeframe.
- Over-relying on single WMA: A price crossing WMA(20) alone triggers too many false signals. Always combine with a secondary filter (trend direction, momentum, volume).
- Ignoring market regime: WMA works best in trending markets. In sideways/choppy price action, it generates whipsaws. Add a volatility filter or range detector.
- Wrong source data: Using WMA on high/low instead of close can create phantom crossovers. Stick to close unless you have a specific reason.
- Not testing period selection: Don't assume WMA(20) is optimal for your asset. Test WMA(10), WMA(20), WMA(30) on historical data to find your best period.
- Confusing WMA direction with momentum: WMA slope indicates trend direction, not strength. Combine with RSI, MACD, or volume for momentum confirmation.
Related indicators
- SMA — Simpler but slower version of WMA; better for long-term trend confirmation.
- EMA — More responsive than WMA; useful when you need maximum reactivity to recent bars.
- HMA (Hull Moving Average) — Lower lag than WMA; combines WMA calculations for enhanced smoothness.
- DEMA — Double EMA; another low-lag alternative combining multiple moving averages.

