Does the 8/21 EMA crossover strategy work on gold?

XAU/USD, 1-hour chart, Oct 2, 2016 to Oct 1, 2026. Backtest run on October 2, 2026.

Key results

Total return
+118.7%
Buy & hold: +217.8%
Annual return (CAGR)
+8.1%
Buy & hold: +12.3%
Max drawdown
-16.7%
Buy & hold: -28.8%
Win rate
33.86%
Profit factor
1.46
Trades
251
Longest losing streak
12 trades
Period
Oct 2, 2016 to Oct 1, 2026
10 years
Market
XAU/USD
1-hour

Equity curve vs buy & hold

StrategyBuy & hold
Cumulative return of the strategy and of buy and hold, XAU/USD, Oct 2, 2016 to Oct 1, 2026At the end of the period the strategy is at +118.8%, against +217.8% for buying and holding XAU/USD over the same days.
Cumulative return in percent of the starting capital. The dashed line holds the asset for the whole period.

Returns year by year

YearReturnTrades
2016-4.8%7
2017+9.8%21
2018-2%9
2019+9.9%9
2020+25.6%28
2021-7.1%26
2022-0.9%28
2023+15.4%22
2024+13.4%22
2025+25.5%30
2026+2.2%49

Calendar years, compounded from monthly results. The first and last years can be partial.

The 8/21 EMA crossover is one of the most shared short-term trend signals: two fast exponential moving averages, and a buy when the faster one crosses above the slower one. Traders like it on gold because the metal tends to move in long, directional swings. We ran it on ten years of hourly XAU/USD data with a fixed 1:3 risk-reward bracket to see what is left once the numbers are counted.

The rules we tested

  • Market and timeframe: gold against the US dollar (XAU/USD), 1-hour candles.
  • Period: 2 October 2016 to 1 October 2026.
  • Entry (long only): buy when EMA(8) crosses above EMA(21). There is no short side.
  • Stop-loss: 1.5% below the entry price.
  • Take-profit: 4.5% above the entry price, so three times the risk.
  • Exit: no indicator exit. A trade ends at the stop or at the target.
  • Costs and sizing: 0.02% commission per side, full position size on a 10,000 starting balance.

What the backtest shows

The strategy grew the account by +119% (8.1% a year). Over the same window, simply holding gold returned +218% (12.3% a year), so the crossover captured a little over half of the move. Gold had an exceptional run in 2024 and 2025, and a strategy that is flat most of the time cannot keep pace with that.

The trade profile is the classic trend-following one. Only 34% of the 251 trades won: 166 hit the stop and 84 reached the target. But the average win (4.41%) was close to three times the average loss (1.54%), which gave a profit factor of 1.46. With a 1:3 bracket, a strategy needs to win roughly one trade in four just to break even, so a third is a real but modest margin.

The price for that is patience. The longest losing streak was 12 trades in a row, and several years were negative: 2021 lost 7.1% (5 winners out of 26 trades), 2018 lost 2.0% and 2022 lost 0.9%. The best years were 2020 (+25.6%) and 2025 (+25.5%), both strong trending years for gold.

On risk, the picture is better. The maximum drawdown was 16.7%, against 28.8% for buy and hold. Commission barely matters here: 251 round trips at 0.04% each add up to about a tenth of the position size over ten years.

Smaller drawdown, smaller return

The lower drawdown comes mostly from being out of the market. It is a genuine difference in experience, but it is not free: it came with giving up roughly half of gold's ten-year gain.

Why it works, and where it falls short

A short EMA crossover is a momentum filter. On a market that trends for weeks, like gold in 2020 or 2025, the crossover catches the start of many moves and the wide 4.5% target lets the good ones pay. In choppy years the two averages cross back and forth, and each false start costs a 1.5% stop. That is exactly what 2021 looks like in the yearly table.

The fixed target is also a ceiling. When gold ran for months, the strategy took 4.5% and stepped aside, then waited for the next crossover. That is the main reason it trails buy and hold in the strongest years.

What you could test next

  • Replace the fixed 4.5% target with a trailing stop, so trending moves are not cut short.
  • Add a long-term trend filter, such as only buying when the close is above the 200-period EMA, to skip the choppy stretches.
  • Run the same crossover on the 4-hour chart to cut the number of false signals.
  • Add the mirror short rule (EMA(8) crossing below EMA(21)) and see whether the down legs add or subtract value.

Methodology and assumptions

Starting capital
10,000
Position size
100% of equity
Commission
0.02% per side
Data window
Oct 2, 2016 to Oct 1, 2026
Run date
October 2, 2026
  • No repainting: every signal is computed on closed candles only, so the backtest never acts on a price a trader could not have seen yet.
  • Past performance does not predict future results. A backtest is a historical simulation, not a forecast.

Frequently asked questions

What is the 8 21 EMA crossover strategy?

It buys when the 8-period exponential moving average crosses above the 21-period one, a short-term signal that momentum has turned up. In this test the trade is then managed only by a fixed stop-loss 1.5% below entry and a take-profit 4.5% above it.

Can a strategy that loses two trades out of three be profitable?

Yes, if the winners are much bigger than the losers. Here the average win was 4.41% and the average loss 1.54%, so a 34% win rate was enough for a profit factor of 1.46.

Is the 8/21 EMA crossover better than buying gold?

Not on return: +119% against +218% over the same ten years. It did keep the worst drop to 16.7% instead of 28.8%, because it is only in the market part of the time.

What timeframe is best for the 8 21 EMA crossover?

This page only measures the 1-hour chart on gold. Other timeframes need their own test: a crossover on a 4-hour or daily chart fires far less often and gives different results.

Reproduce it, then change it

Every number on this page comes from the Backtrex engine. Rebuild the strategy in the app, then change the market, the timeframe or a parameter and see whether the result holds.

Ready to backtest your strategies?

Create your free account and take the guided tour: a real 10-year backtest in 3 minutes, no coding, no credit card.

Create your account in 30 seconds and run your first backtest. No credit card.

Other backtests