WMA Crossover Backtest on BTC/USDT: The Weighted Average Nobody Picks β and Why
The WMA crossover on real hourly BTC/USDT 2023: +72.72% naive, +52.75% with fees/funding, +9.75% at 25bp across only 66 trades. A face-off with the SMA and EMA crossovers of the same fast/slow pair.
WMA Crossover Backtest on BTC/USDT (2023, hourly, real fees)
The weighted moving average is the middle child of the averaging family: it gives recent prices more weight than old ones (unlike the SMA, which treats every bar equally), but it's a one-pass calculation with none of the EMA's elegant recursion. Everyone uses SMA and EMA; almost nobody sets up a WMA crossover. So I set one up β WMA(24) vs WMA(120), long when the fast weighted line is above β and put it in the ring with its two more famous siblings from posts 01 and 02. Strategy Lab #22.
Results
| Strategy | Category | Total return | CAGR | MaxDD | Sharpe | Trades |
|---|---|---|---|---|---|---|
| wma_cross | trend | +52.75% | +52.93% | -32.02% | 1.44 | 66 |

At zero cost the WMA makes +72.72% β and here's a genuinely useful number: only 66 trades. The WMA's linear weighting makes the slow line "stickier" in a specific way β it waits longer to flip than the exponentially-weighted EMA, which fades old data faster. Fewer flips means fewer legs, which is exactly what keeps a strategy alive under slippage.
The three-way face-off (same 24/120 pair, same year)
| Crossover | Naive | Fees+funding | 25bp | Trades |
|---|---|---|---|---|
| SMA (post 02) | +87.68% | +68.08% | +28.89% | 53 |
| EMA (post 01) | +110.12% | +89.38% | +51.17% | 45 |
| WMA (this) | +72.72% | +52.75% | +9.75% | 66 |
Three averages, three different profiles. EMA wins on raw return by a mile β and, thanks to trading least (45), it also survives slippage best. WMA's story is modest return with modest churn: every column stays positive, but nothing to write home about. SMA sits between them on trade count and lands in the middle of the table. Which average you pick matters less than how often you let it trade β the WMA's only real edge is that it doesn't.
The fee bill
| Scenario | Cost/leg | Total return | MaxDD | Sharpe | Trades | |---|---:|---:|---:|---:|---:|---:| | naive (zero cost) | 0.00% | +72.72% | -27.79% | 1.81 | 66 | | taker fee 0.05%/leg | 0.05% | +61.69% | -30.56% | 1.61 | 66 | | + funding 0.01%/8h | 0.05% | +52.75% | -32.02% | 1.44 | 66 | | + slippage 10bp/leg | 0.15% | +33.84% | -37.12% | 1.04 | 66 | | + slippage 25bp/leg | 0.30% | +9.75% | -44.59% | 0.45 | 66 |

+72.72% β +9.75%. Positive through every column, like the EMA and SMA siblings. Win rate was 27.3% (18/66) β the classic trend-following shape: lose often, win big. The -32.02% max drawdown at fees is the deepest of the three averages though, so "survives costs" and "rides smoothly" are two different qualities.
What this does NOT prove
- WMA's stickiness is regime-dependent. In 2023 the fewer-flips approach cost it return; in a violent chop it could save it.
- Three averaging schemes on one pair is a family portrait, not a parameter search. Sensitivities (40, 60, 90 as slow periods) are covered in the moving-average roundup later in the series.
- None of this says "pick the average with the best table" β it says "pick the frequency your fees can survive."
Code
from backtest_base import fetch, backtest_signal, metrics
df = fetch("BTCUSDT", "binance", "2023-01-01", "2023-12-31", "1h")
c = df["close"]
def wma(period):
w = np.arange(1, period + 1)
return c.rolling(period).apply(
lambda y: float(np.dot(y, w) / w.sum()), raw=True)
signal = (wma(24) > wma(120)).fillna(False)
res = backtest_signal(df, signal, cost_per_leg=0.0005,
funding_per_bar=0.0001 / 8.0)
print(metrics(res, 8760))Reproduce it
cd blog-drafts/scripts
python backtest_base.py --strategy wma_cross --symbol BTCUSDT --interval 1h \
--start 2023-01-01 --end 2023-12-31 --fee 0.0005 --funding 0.0000125Data: Binance public API, hourly OHLCV, 8,735 bars. The tables above reproduce exactly from this command.
This is a backtest on historical data, not investment advice. Past performance does not predict future results.