Markets › Metals · XAUUSD spot (broker data, 15-minute and 1-hour bars)
EMA 9/20 Crossover Backtest: Gold on 15-Minute and 1-Hour Bars
The 9-bar exponential average crossing the 20-bar one on spot gold (XAUUSD), 2004 to 2026, on 15-minute and 1-hour bars, long only and long and short, with and without a stop and targets.
Buried · No proven edgePassed five gates on the hourly chart. Validation said no.
Variants tried: 24 · Passed every gate: 0 · Holdout opened: yes (used before)
Short answer: not in this test. We backtested the EMA 9/20 crossover on 22 years of spot gold, on 15-minute and 1-hour bars, in 24 variants, net of costs. None passed every gate. On 15-minute bars none of the variants made money after costs; on 1-hour bars the long-only version with no stop made +610 R but failed validation, and today's swap would take most of it.How much costs took here, compared across all 54 of our tests →Compare all 14 gold strategies we tested →
00The verdict in three lines
- We tested the EMA 9/20 crossover on 22 years of spot gold: buy when the 9-bar exponential average crosses above the 20-bar one, sell when it crosses below, on 15-minute and 1-hour bars, long only and long and short, with no stop, a 1 R stop, and targets at 1 R, 2 R and 3 R. 24 variants, with the rules, costs, gates and a matched control fixed in a dated specification before any EMA 9/20 value was computed on gold.
- None passed. On 15-minute bars none of the 12 made money after costs (-697 R to -4,038 R). On 1-hour bars the long-only version with no stop made +610 R and beat the matched control, but failed the validation gate (profit factor 1.05 in 2013 to 2019, 1.2 needed).
- Two warnings on the best result. With today's IC Markets swap charged on every night held it falls to +29 R, and without the trades that crossed holes in the thin 2004 to 2012 data its development t-statistic falls below 2.5.
01What we tested
The rule: EMA(9) and EMA(20) of the bar closes (each seeded with a simple average, then ema = a x close + (1 - a) x previous ema with a = 2 / (n + 1)). A golden cross at the close of a bar opens a long at the next available 1-minute open; a death cross closes it and, in the long-and-short versions, opens a short. The signal is read only on a closed bar. All 24 hours, positions held over weekends. Exits and R: 1 R = 1.5 times the 14-bar ATR of the same timeframe at the signal bar; a stop at 1 R; targets at 1 R, 2 R or 3 R, or a third at each (T123); if a stop and a target are touched in the same minute the stop is taken; a level gapped through fills at the open of that minute. The 12 variants per timeframe are long only (L) and long and short (LS) with six exit rules: N, S, T1, T2, T3 and T123.
Why this test, stated plainly. The pair 9/20 is a popular short-term setting. We chose gold after trend rules had done best there in our earlier tests (the 1-hour golden cross on the same data passed every gate with long only and no stop, before a data check made it Inconclusive). That weakens any positive result here, and at least 28 earlier protocolled variants were already tried on this gold series.
02Data and costs
Instrument: XAUUSD on an IC Markets MetaTrader 4 demo server, a spot gold CFD quoted in dollars per ounce, not a futures contract. Bid prices, 1-minute history from 11 Jun 2004 to 7 Oct 2026 (the same part of the file as our other gold tests), built into 512,811 15-minute and 129,857 1-hour bars on the New York clock. Periods: development 2004 to 2012, validation 2013 to 2019, holdout 2020 to October 2026. None of them is fresh: all three were used by our earlier gold tests, so the holdout is reported as already used.
Costs: $0.30 an ounce per round trip for spread and commission, with no slippage, which is optimistic. That is about 0.16 R a trade on 15-minute bars and 0.07 R on 1-hour bars. No overnight charge in the baseline, as in our other gold tests; two scenarios are reported next to it (section 07). For scale, one ounce bought on 14 Jun 2004 and held to the end made +$3,727, with a worst fall of $1,600 along the way.
Engine check: before the run we re-ran our published 1-hour golden cross on gold with the changed engine and got every trade and every control statistic back (gx_repro_result.txt), and gx_selftest.js checked hand-built cases (a stop and a target in the same minute, a stop in the entry minute, a gap through the stop, a signal before a data gap), the 15-minute bars against a naive aggregation, the averages and signals against a naive recomputation, and all 24 variants trade by trade against an independent re-implementation (gx_selftest_result.txt).
03Results: all 24 variants
Net R is the sum of the trades' results in R after costs, gross R the same before costs. Dollars are per ounce. The 95% range is the Wilson interval for the win rate. The drawdown column includes open losses.
| Variant | Trades | Net after costs | R per trade | Gross, before costs | $ per ounce | Winners (95% range) | Profit factor | Drawdown incl. open losses | Verdict |
|---|---|---|---|---|---|---|---|---|---|
| H1-L-N | 2,865 | +610 R | +0.21 R | +810.1 R | +$3,626 | 886 of 2865 (29% to 33%) | 1.29 | -57.0 R | Buried |
| H1-L-S | 2,865 | +529 R | +0.18 R | +729.6 R | +$3,326 | 783 of 2865 (26% to 29%) | 1.29 | -55.9 R | Buried |
| H1-L-T1 | 2,865 | -74 R | -0.03 R | +126.0 R | -$413 | 1358 of 2865 (46% to 49%) | 0.95 | -91.5 R | Buried |
| H1-L-T2 | 2,865 | +75 R | +0.03 R | +274.8 R | +$267 | 949 of 2865 (31% to 35%) | 1.04 | -63.3 R | Buried |
| H1-L-T3 | 2,865 | +179 R | +0.06 R | +379.6 R | +$1,096 | 828 of 2865 (27% to 31%) | 1.10 | -52.7 R | Buried |
| H1-L-T123 | 2,865 | +60 R | +0.02 R | +260.2 R | +$317 | 1057 of 2865 (35% to 39%) | 1.04 | -61.2 R | Buried |
| H1-LS-N | 5,730 | +469 R | +0.08 R | +870.3 R | +$3,526 | 1653 of 5730 (28% to 30%) | 1.11 | -91.7 R | Buried |
| H1-LS-S | 5,730 | +481 R | +0.08 R | +882.4 R | +$2,811 | 1448 of 5730 (24% to 26%) | 1.13 | -66.0 R | Buried |
| H1-LS-T1 | 5,730 | -280 R | -0.05 R | +121.8 R | -$1,642 | 2660 of 5730 (45% to 48%) | 0.90 | -294.3 R | Buried |
| H1-LS-T2 | 5,730 | -108 R | -0.02 R | +293.3 R | -$374 | 1809 of 5730 (30% to 33%) | 0.97 | -142.8 R | Buried |
| H1-LS-T3 | 5,730 | +118 R | +0.02 R | +519.2 R | +$1,170 | 1562 of 5730 (26% to 28%) | 1.03 | -97.2 R | Buried |
| H1-LS-T123 | 5,730 | -90 R | -0.02 R | +311.4 R | -$282 | 2007 of 5730 (34% to 36%) | 0.97 | -119.9 R | Buried |
| M15-L-N | 12,030 | -697 R | -0.06 R | +1191.2 R | -$693 | 3247 of 12030 (26% to 28%) | 0.93 | -1058.1 R | Buried |
| M15-L-S | 12,030 | -828 R | -0.07 R | +1060.4 R | -$1,133 | 2789 of 12030 (22% to 24%) | 0.91 | -1144.2 R | Buried |
| M15-L-T1 | 12,030 | -1,941 R | -0.16 R | -52.5 R | -$4,253 | 5336 of 12030 (43% to 45%) | 0.70 | -1954.9 R | Buried |
| M15-L-T2 | 12,030 | -1,664 R | -0.14 R | +224.2 R | -$3,616 | 3695 of 12030 (30% to 32%) | 0.79 | -1733.2 R | Buried |
| M15-L-T3 | 12,030 | -1,476 R | -0.12 R | +412.2 R | -$2,923 | 3154 of 12030 (25% to 27%) | 0.83 | -1594.0 R | Buried |
| M15-L-T123 | 12,030 | -1,694 R | -0.14 R | +194.6 R | -$3,597 | 4047 of 12030 (33% to 34%) | 0.76 | -1739.6 R | Buried |
| M15-LS-N | 24,061 | -2,774 R | -0.12 R | +1025.7 R | -$5,113 | 6134 of 24061 (25% to 26%) | 0.87 | -2979.4 R | Buried |
| M15-LS-S | 24,061 | -2,610 R | -0.11 R | +1190.0 R | -$4,743 | 5276 of 24061 (21% to 22%) | 0.86 | -2817.5 R | Buried |
| M15-LS-T1 | 24,061 | -4,038 R | -0.17 R | -238.0 R | -$8,283 | 10663 of 24061 (44% to 45%) | 0.69 | -4069.0 R | Buried |
| M15-LS-T2 | 24,061 | -3,815 R | -0.16 R | -15.1 R | -$7,971 | 7238 of 24061 (30% to 31%) | 0.77 | -3863.2 R | Buried |
| M15-LS-T3 | 24,061 | -3,608 R | -0.15 R | +191.8 R | -$7,152 | 6077 of 24061 (25% to 26%) | 0.79 | -3690.9 R | Buried |
| M15-LS-T123 | 24,061 | -3,820 R | -0.16 R | -20.4 R | -$7,802 | 7924 of 24061 (32% to 34%) | 0.73 | -3864.5 R | Buried |
Cumulative net R by month for three variants. * Holdout already used before this test.
Net R by period
| Variant | Development 2004 to 2012 | Validation 2013 to 2019 | Holdout* 2020 to 2026 | Development t | Validation PF |
|---|---|---|---|---|---|
| H1-L-N | +327 R | +32 R | +251 R | 3.80 | 1.05 |
| H1-L-S | +253 R | +44 R | +232 R | 3.28 | 1.07 |
| H1-L-T1 | +7 R | -60 R | -21 R | 0.20 | 0.87 |
| H1-L-T2 | +103 R | -49 R | +21 R | 2.29 | 0.91 |
| H1-L-T3 | +153 R | -38 R | +65 R | 2.83 | 0.94 |
| H1-L-T123 | +87 R | -49 R | +22 R | 2.16 | 0.90 |
| H1-LS-N | +234 R | +58 R | +176 R | 1.99 | 1.04 |
| H1-LS-S | +158 R | +129 R | +194 R | 1.52 | 1.10 |
| H1-LS-T1 | -132 R | -69 R | -79 R | -2.95 | 0.92 |
| H1-LS-T2 | -25 R | -63 R | -21 R | -0.39 | 0.94 |
| H1-LS-T3 | +87 R | -1 R | +32 R | 1.15 | 1.00 |
| H1-LS-T123 | -23 R | -44 R | -23 R | -0.41 | 0.95 |
| M15-L-N | -342 R | -492 R | +136 R | -1.80 | 0.85 |
| M15-L-S | -371 R | -546 R | +88 R | -2.24 | 0.81 |
| M15-L-T1 | -885 R | -765 R | -291 R | -12.93 | 0.64 |
| M15-L-T2 | -748 R | -734 R | -182 R | -8.20 | 0.72 |
| M15-L-T3 | -649 R | -693 R | -134 R | -6.09 | 0.75 |
| M15-L-T123 | -761 R | -731 R | -202 R | -9.26 | 0.69 |
| M15-LS-N | -1,549 R | -728 R | -498 R | -5.75 | 0.89 |
| M15-LS-S | -1,461 R | -729 R | -420 R | -6.31 | 0.87 |
| M15-LS-T1 | -1,976 R | -1,362 R | -700 R | -20.63 | 0.67 |
| M15-LS-T2 | -1,825 R | -1,316 R | -673 R | -14.33 | 0.75 |
| M15-LS-T3 | -1,788 R | -1,203 R | -616 R | -12.03 | 0.78 |
| M15-LS-T123 | -1,863 R | -1,294 R | -663 R | -16.32 | 0.72 |
04Stops, targets, longs and shorts
| Exit rule | 1-hour, long only | 1-hour, long and short | 15-minute, long only | 15-minute, long and short |
|---|---|---|---|---|
| N: no stop, no target | +609.9 R | +468.8 R | -697.2 R | -2773.9 R |
| S: stop 1 R only | +529.4 R | +480.9 R | -827.9 R | -2609.7 R |
| T1: stop 1 R, target 1 R | -74.2 R | -279.8 R | -1940.8 R | -4037.6 R |
| T2: stop 1 R, target 2 R | +74.6 R | -108.3 R | -1664.1 R | -3814.8 R |
| T3: stop 1 R, target 3 R | +179.4 R | +117.6 R | -1476.1 R | -3607.8 R |
| T123: a third at 1 R, 2 R and 3 R | +59.9 R | -90.2 R | -1693.7 R | -3820.1 R |
On 1-hour bars the versions without a target did best; the tight targets (1 R) lost money. On 15-minute bars every combination lost.
| Variant (long and short) | Long side, net R | Short side, net R |
|---|---|---|
| H1-LS-N | +609.9 R | -141.1 R |
| H1-LS-S | +529.4 R | -48.5 R |
| H1-LS-T1 | -74.2 R | -205.6 R |
| H1-LS-T2 | +74.6 R | -182.9 R |
| H1-LS-T3 | +179.4 R | -61.7 R |
| H1-LS-T123 | +59.9 R | -150.1 R |
| M15-LS-N | -697.2 R | -2076.7 R |
| M15-LS-S | -827.9 R | -1781.7 R |
| M15-LS-T1 | -1940.8 R | -2096.8 R |
| M15-LS-T2 | -1664.1 R | -2150.6 R |
| M15-LS-T3 | -1476.1 R | -2131.7 R |
| M15-LS-T123 | -1693.7 R | -2126.4 R |
The short side lost money in every long-and-short variant.
05Is it the signal or the market?
The benchmark is a circularly shifted state-series control: the state (+1 while the 9-bar average is above the 20-bar one, -1 below) is shifted by a random offset of at least 5% of its length, so the same up and down episodes fall on other dates; the real prices, rules and costs are applied and R is recomputed at the shifted signal time. 500 runs with fixed seeds; the bar is the 95th percentile of the average net R per trade.
| Variant | Trades | Real average per trade | Control median | Control 5th to 95th | Percentile (95 needed) |
|---|---|---|---|---|---|
| H1-L-N | 2,865 | +0.21 R | +0.07 R | +0.02 R to +0.13 R | 100.0 |
| H1-L-S | 2,865 | +0.18 R | +0.01 R | -0.03 R to +0.06 R | 100.0 |
| H1-L-T1 | 2,865 | -0.03 R | -0.06 R | -0.09 R to -0.04 R | 99.2 |
| H1-L-T2 | 2,865 | +0.03 R | -0.05 R | -0.08 R to -0.01 R | 100.0 |
| H1-L-T3 | 2,865 | +0.06 R | -0.03 R | -0.06 R to +0.01 R | 100.0 |
| H1-L-T123 | 2,865 | +0.02 R | -0.05 R | -0.08 R to -0.01 R | 100.0 |
| H1-LS-N | 5,730 | +0.08 R | -0.06 R | -0.11 R to 0.00 R | 100.0 |
| H1-LS-S | 5,730 | +0.08 R | -0.03 R | -0.07 R to 0.00 R | 100.0 |
| H1-LS-T1 | 5,730 | -0.05 R | -0.07 R | -0.09 R to -0.05 R | 95.4 |
| H1-LS-T2 | 5,730 | -0.02 R | -0.06 R | -0.09 R to -0.04 R | 100.0 |
| H1-LS-T3 | 5,730 | +0.02 R | -0.06 R | -0.08 R to -0.03 R | 100.0 |
| H1-LS-T123 | 5,730 | -0.02 R | -0.06 R | -0.09 R to -0.04 R | 100.0 |
| M15-L-N | 12,030 | -0.06 R | -0.09 R | -0.12 R to -0.06 R | 93.2 |
| M15-L-S | 12,030 | -0.07 R | -0.11 R | -0.14 R to -0.09 R | 100.0 |
| M15-L-T1 | 12,030 | -0.16 R | -0.14 R | -0.16 R to -0.13 R | 0.6 |
| M15-L-T2 | 12,030 | -0.14 R | -0.14 R | -0.16 R to -0.13 R | 57.6 |
| M15-L-T3 | 12,030 | -0.12 R | -0.14 R | -0.15 R to -0.12 R | 94.0 |
| M15-L-T123 | 12,030 | -0.14 R | -0.14 R | -0.15 R to -0.13 R | 51.2 |
| M15-LS-N | 24,061 | -0.12 R | -0.15 R | -0.18 R to -0.12 R | 98.2 |
| M15-LS-S | 24,061 | -0.11 R | -0.14 R | -0.15 R to -0.12 R | 100.0 |
| M15-LS-T1 | 24,061 | -0.17 R | -0.15 R | -0.16 R to -0.14 R | 0.2 |
| M15-LS-T2 | 24,061 | -0.16 R | -0.15 R | -0.17 R to -0.14 R | 23.6 |
| M15-LS-T3 | 24,061 | -0.15 R | -0.15 R | -0.16 R to -0.14 R | 56.2 |
| M15-LS-T123 | 24,061 | -0.16 R | -0.15 R | -0.16 R to -0.14 R | 19.2 |
Many hourly variants beat the control, including some that lost money: the control's own results are negative there, so beating it is not the same as making money. The 15-minute long-only no-stop version beat 93.2% of the control runs and still lost 697 R.
06The gates
| Variant | Trades | 1. PF ≥ 1.2 in validation | 2. ≥ 50 trades in each period | 3. t ≥ 2.5 on development | 4. Above the 95th percentile of the shifted-state control | 5. Positive without the 10 best trades | 6. Holdout net positive (already used) |
|---|---|---|---|---|---|---|---|
| H1-L-N | 2,865 | fail | pass | pass | pass | pass | pass |
| H1-L-S | 2,865 | fail | pass | pass | pass | pass | pass |
| H1-L-T1 | 2,865 | fail | pass | fail | pass | fail | fail |
| H1-L-T2 | 2,865 | fail | pass | fail | pass | pass | pass |
| H1-L-T3 | 2,865 | fail | pass | pass | pass | pass | pass |
| H1-L-T123 | 2,865 | fail | pass | fail | pass | pass | pass |
| H1-LS-N | 5,730 | fail | pass | fail | pass | pass | pass |
| H1-LS-S | 5,730 | fail | pass | fail | pass | pass | pass |
| H1-LS-T1 | 5,730 | fail | pass | fail | pass | fail | fail |
| H1-LS-T2 | 5,730 | fail | pass | fail | pass | fail | fail |
| H1-LS-T3 | 5,730 | fail | pass | fail | pass | pass | pass |
| H1-LS-T123 | 5,730 | fail | pass | fail | pass | fail | fail |
| M15-L-N | 12,030 | fail | pass | fail | fail | fail | pass |
| M15-L-S | 12,030 | fail | pass | fail | pass | fail | pass |
| M15-L-T1 | 12,030 | fail | pass | fail | fail | fail | fail |
| M15-L-T2 | 12,030 | fail | pass | fail | fail | fail | fail |
| M15-L-T3 | 12,030 | fail | pass | fail | fail | fail | fail |
| M15-L-T123 | 12,030 | fail | pass | fail | fail | fail | fail |
| M15-LS-N | 24,061 | fail | pass | fail | pass | fail | fail |
| M15-LS-S | 24,061 | fail | pass | fail | pass | fail | fail |
| M15-LS-T1 | 24,061 | fail | pass | fail | fail | fail | fail |
| M15-LS-T2 | 24,061 | fail | pass | fail | fail | fail | fail |
| M15-LS-T3 | 24,061 | fail | pass | fail | fail | fail | fail |
| M15-LS-T123 | 24,061 | fail | pass | fail | fail | fail | fail |
Three hourly long-only variants (no stop, stop only, and stop with a 3 R target) failed only gate 1: their validation profit factors were 1.05, 1.07, 0.94, against 1.2 needed. In our protocol's terms they are Overfit: they passed development and failed validation. Nothing was tuned; the word means the result did not hold in a later period. Gate 3 needs a development t-statistic of 2.5 because many variants were tried.
07Overnight costs: two scenarios
The baseline charges no overnight cost. Scenario A charges 3% a year of the entry price for every calendar day held, longs and shorts alike, as in our 1-hour golden cross test. Scenario B applies the swap rates shown in the IC Markets terminal on 8 October 2026 to the whole history: long -$0.563, short +$0.391 an ounce per night (swap in points: -56.282 and +39.136, 1 point = $0.01, 100 ounces a lot), charged at each 17:00 New York rollover from Monday to Friday, with the Wednesday rollover counted three times. These are today's rates, not a historical swap. Every gate, including the control, was recomputed under each scenario.
| Variant | Baseline net | t | A: 3% a year, net | t | A: gates failed | B: current swap, net | t | B: gates failed |
|---|---|---|---|---|---|---|---|---|
| H1-L-N | +610 R | 4.12 | +513 R | 3.52 | 1 | +29 R | 0.21 | 1, 3, 5 |
| H1-L-S | +529 R | 3.92 | +446 R | 3.36 | 1 | +40 R | 0.32 | 1, 3, 5 |
| H1-L-T1 | -74 R | -1.45 | -97 R | -1.88 | 1, 3, 5, 6 | -207 R | -3.99 | 1, 3, 5, 6 |
| H1-L-T2 | +75 R | 1.04 | +39 R | 0.54 | 1, 3 | -133 R | -1.86 | 1, 3, 5, 6 |
| H1-L-T3 | +179 R | 2.09 | +133 R | 1.55 | 1 | -93 R | -1.09 | 1, 3, 5 |
| H1-L-T123 | +60 R | 0.93 | +25 R | 0.39 | 1, 3, 5 | -144 R | -2.26 | 1, 3, 5, 6 |
| H1-LS-N | +469 R | 2.36 | +291 R | 1.48 | 1, 3 | +229 R | 1.17 | 1, 3, 5 |
| H1-LS-S | +481 R | 2.68 | +331 R | 1.87 | 1, 3 | +271 R | 1.54 | 1, 3 |
| H1-LS-T1 | -280 R | -3.87 | -321 R | -4.44 | 1, 3, 5, 6 | -331 R | -4.57 | 1, 3, 4, 5, 6 |
| H1-LS-T2 | -108 R | -1.07 | -175 R | -1.73 | 1, 3, 5, 6 | -193 R | -1.91 | 1, 3, 5, 6 |
| H1-LS-T3 | +118 R | 0.97 | +32 R | 0.27 | 1, 3, 5 | +4 R | 0.03 | 1, 3, 5 |
| H1-LS-T123 | -90 R | -1.00 | -155 R | -1.72 | 1, 3, 5, 6 | -174 R | -1.92 | 1, 3, 5, 6 |
| M15-L-N | -697 R | -2.33 | -895 R | -3.02 | 1, 3, 4, 5 | -1,737 R | -6.03 | 1, 3, 4, 5, 6 |
| M15-L-S | -828 R | -3.14 | -993 R | -3.79 | 1, 3, 5 | -1,697 R | -6.68 | 1, 3, 5, 6 |
| M15-L-T1 | -1,941 R | -18.27 | -1,994 R | -18.78 | 1, 3, 4, 5, 6 | -2,269 R | -21.21 | 1, 3, 4, 5, 6 |
| M15-L-T2 | -1,664 R | -11.55 | -1,749 R | -12.16 | 1, 3, 4, 5, 6 | -2,125 R | -14.77 | 1, 3, 4, 5, 6 |
| M15-L-T3 | -1,476 R | -8.72 | -1,579 R | -9.35 | 1, 3, 4, 5, 6 | -2,000 R | -11.88 | 1, 3, 4, 5, 6 |
| M15-L-T123 | -1,694 R | -13.14 | -1,774 R | -13.79 | 1, 3, 4, 5, 6 | -2,132 R | -16.57 | 1, 3, 4, 5, 6 |
| M15-LS-N | -2,774 R | -6.31 | -3,150 R | -7.20 | 1, 3, 5, 6 | -3,132 R | -7.16 | 1, 3, 5, 6 |
| M15-LS-S | -2,610 R | -6.68 | -2,921 R | -7.52 | 1, 3, 5, 6 | -2,906 R | -7.48 | 1, 3, 5, 6 |
| M15-LS-T1 | -4,038 R | -26.89 | -4,141 R | -27.57 | 1, 3, 4, 5, 6 | -4,137 R | -27.45 | 1, 3, 4, 5, 6 |
| M15-LS-T2 | -3,815 R | -18.78 | -3,976 R | -19.59 | 1, 3, 4, 5, 6 | -3,965 R | -19.51 | 1, 3, 4, 5, 6 |
| M15-LS-T3 | -3,608 R | -15.11 | -3,803 R | -15.95 | 1, 3, 4, 5, 6 | -3,777 R | -15.83 | 1, 3, 4, 5, 6 |
| M15-LS-T123 | -3,820 R | -21.08 | -3,974 R | -21.96 | 1, 3, 4, 5, 6 | -3,960 R | -21.84 | 1, 3, 4, 5, 6 |
No scenario changed a verdict. Scenario B removes most of the hourly long-only result (+610 R to +29 R): at today's rates a long position pays more overnight than the signal earns.
08Verdict by variant
| Variant | Cause | Gates failed | Verdict |
|---|---|---|---|
| H1-L-N | Overfit | 1 | Buried |
| H1-L-S | Overfit | 1 | Buried |
| H1-L-T1 | Costs | 1, 3, 5, 6 | Buried |
| H1-L-T2 | No proven edge | 1, 3 | Buried |
| H1-L-T3 | Overfit | 1 | Buried |
| H1-L-T123 | No proven edge | 1, 3 | Buried |
| H1-LS-N | No proven edge | 1, 3 | Buried |
| H1-LS-S | No proven edge | 1, 3 | Buried |
| H1-LS-T1 | Costs | 1, 3, 5, 6 | Buried |
| H1-LS-T2 | Costs | 1, 3, 5, 6 | Buried |
| H1-LS-T3 | No proven edge | 1, 3 | Buried |
| H1-LS-T123 | Costs | 1, 3, 5, 6 | Buried |
| M15-L-N | Costs | 1, 3, 4, 5 | Buried |
| M15-L-S | Costs | 1, 3, 5 | Buried |
| M15-L-T1 | No proven edge | 1, 3, 4, 5, 6 | Buried |
| M15-L-T2 | Costs | 1, 3, 4, 5, 6 | Buried |
| M15-L-T3 | Costs | 1, 3, 4, 5, 6 | Buried |
| M15-L-T123 | Costs | 1, 3, 4, 5, 6 | Buried |
| M15-LS-N | Costs | 1, 3, 5, 6 | Buried |
| M15-LS-S | Costs | 1, 3, 5, 6 | Buried |
| M15-LS-T1 | No proven edge | 1, 3, 4, 5, 6 | Buried |
| M15-LS-T2 | No proven edge | 1, 3, 4, 5, 6 | Buried |
| M15-LS-T3 | Costs | 1, 3, 4, 5, 6 | Buried |
| M15-LS-T123 | No proven edge | 1, 3, 4, 5, 6 | Buried |
“Costs” marks a variant that was positive before costs and not after. What this test covers: the EMA 9/20 crossover on XAUUSD spot, 15-minute and 1-hour bars, 2004 to 2026, around the clock, R fixed at 1.5 ATR(14), with the costs above. Not tested: other pairs, other timeframes, filters, other stop sizes, gold futures, live fills.
TWhat this shows, and what to take into your own tests
What the results show
- None of the 24 variants passed. On 15-minute bars none of the 12 made money after costs (-697 R to -4,038 R): the signal fires about 539 times a year in the long-only version and costs about 0.16 R a trade, more than the edge before costs.
- On 1-hour bars the long-only version with no stop made +610 R (+$3,626 an ounce), beat the shifted-state control (percentile 100.0) and had a development t-statistic of 3.80, but its validation profit factor was 1.05 (1.2 needed). Three hourly long-only variants failed only that gate.
- With today's IC Markets swap applied to every night held, the same variant drops to +29 R (t 0.21); with 3% a year of financing it keeps +513 R.
- The short side lost money in every long-and-short variant, on a market that rose about tenfold over the period.
What remains unknown
- Whether the hourly long-only result is a property of the signal or of gold's long rise: buy and hold made more in dollars, and this test was chosen after trend rules had done well on gold.
- How much of the 2004 to 2012 strength is real: that part of the data is thin, and without the trades that crossed data holes the development t-statistic drops below 2.5.
- Real broker costs over 22 years: the spread, slippage and swap of 2004 were not those of today.
Why nothing passed
On 15-minute bars the crossover trades too often for its edge: costs of about 0.16 R a trade turn +1,191 R before costs into -697 R for the long-only version. On 1-hour bars costs are smaller (0.07 R a trade) and the long side made money in development and in the holdout, but almost nothing from 2013 to 2019 (validation +32 R, profit factor 1.05). A rule that works in some decades and not in others, on a market that mostly rose, is not proven.
What you can apply to your own tests
- Test the same rule on two timeframes before you trust either: here one lost and the other did not.
- Charge the real overnight cost of your broker. A result that disappears with today's swap is a carry bet as much as a signal.
- Audit your data first: here the clock was wrong in 20 weeks and the first years are thin.
- Look at the validation period on its own. A good start and a good finish do not make up for a flat middle.
A note on the numbers: drawdown figures are measured on closed trades unless a table says it includes open losses. Open losses inside a trade are not counted in a closed-trade drawdown, so real account risk is higher, especially for systems with no stop. Backtests are not live trading.
FAQCommon questions
Does the 9 and 20 EMA crossover work on gold?
Not in our test. On 1-hour bars the long-only version with no stop made +610 R (+$3,626 an ounce, less than buy and hold) and beat a matched control, but its profit factor in 2013 to 2019 was 1.05, below the 1.2 we require. On 15-minute bars it lost 697 R.
Is the EMA 9/20 crossover better on the 15-minute or the 1-hour chart?
The 1-hour chart. On 15-minute bars the signal fires about 539 times a year and costs about 0.16 R a trade, which turned +1,191 R before costs into -697 R after. On 1-hour bars costs are about 0.07 R a trade.
How much does swap change an EMA crossover on gold?
A lot. With today's IC Markets swap (-$0.563 an ounce a night for longs) charged on every night held, the 1-hour long-only result falls from +610 R to +29 R. With 3% a year of financing it keeps +513 R.
How was the EMA 9/20 crossover tested on gold?
On XAUUSD broker data from 2004 to 2026, with rules written and dated before the data was run, costs included on every trade, results split into development, validation and holdout periods, a random-entry control as the benchmark, and every variant reported. The data was audited first: a clock error in 20 weeks was fixed and thin early years and data holes are listed. Read the protocol.
09Check our arithmetic
gx_spec.md
gx_lib.js · gx_run.js · make_gx_run.js · gx_selftest.js · gx_repro.js · gh_lib.js · ma_lib.js · fx_data.js · control_audit_lib.js · hourly_lib.js · rsi2_protocol.js
gx_selftest_result.txt · gx_repro_result.txt · gx_results.txt · gx_summary.json
1-hour · 15-minute
gx_timecheck.txt · gx_audit.txt · data_holes_xau.json · mt4_prefix_hashes.json · hole_sensitivity.txt
Code provenance: our own code, written from the standard definitions of the exponential moving average and of the ATR. No third-party source code is used or published.
10Data notes
The data was audited before the run; three findings matter.
- The clock. The MetaTrader server is normally New York + 7 hours, but in 20 weeks between 2020 and 2026 (the weeks when the US and European clocks differ) it followed the European change, so the daily break showed one hour early. Those weeks were moved back by one hour before the run. On our published 1-hour golden cross this changes only time stamps, no trade result.
- The last minute. Our earlier gold runs read the file when its last bar (7 October 2026, 16:57) was still forming; its close is now 4109.91 instead of 4109.82. This test uses the file as it is now; with the old value, the earlier results reproduce exactly.
- Thin early years and holes. From 2004 to 2012 the history has 558 to 1,284 one-minute bars a day, against about 1,350 from 2013. We listed every gap over 30 minutes: 7,254 in all, of which 4,354 are normal closes (daily break, weekends, holidays) and 2,900 are suspect or unclear (2,099 windows after merging). Nothing was filled; the averages run on across a gap, and a position open across it is checked from the first bar after it.
| Year | One-minute bars per weekday | Suspect or unclear gaps |
|---|---|---|
| 2004 | 568 | 279 |
| 2005 | 558 | 419 |
| 2006 | 662 | 313 |
| 2007 | 941 | 245 |
| 2008 | 1,223 | 200 |
| 2009 | 1,281 | 128 |
| 2010 | 1,237 | 421 |
| 2011 | 1,262 | 306 |
| 2012 | 1,284 | 303 |
| 2013 | 1,351 | 38 |
| 2014 | 1,351 | 22 |
| 2015 | 1,344 | 28 |
| 2016 | 1,358 | 22 |
| 2017 | 1,358 | 17 |
| 2018 | 1,355 | 18 |
| 2019 | 1,355 | 24 |
| 2020 | 1,356 | 16 |
| 2021 | 1,361 | 7 |
| 2022 | 1,368 | 0 |
| 2023 | 1,373 | 1 |
| 2024 | 1,373 | 0 |
| 2025 | 1,364 | 12 |
| 2026 | 1,348 | 81 |
Hole test. We removed every trade that was open across a suspect or unclear gap and recomputed the gates (the control percentile as in the run): 18,922 trade-hole overlaps summed over the 24 variants, no verdict changed. But the three hourly long-only variants that failed only validation would also fail gate 3: for the version with no stop, 600 of its 2,865 trades crossed a hole, and without them its development t-statistic is -7.85. This strict test is biased against rules that hold winners for a long time: long trades are the most likely to cross a gap in the thin years, so removing them removes mostly winners. It tells us the early strength cannot be separated from the data problem; it does not show that the gaps created it.
| Variant | Trades | Across a hole | Net of those | Verdict | Gate changes |
|---|---|---|---|---|---|
| M15-L-N | 12,030 | 956 | +1,959 R | Buried → Buried | none |
| M15-L-S | 12,030 | 827 | +1,623 R | Buried → Buried | none |
| M15-L-T1 | 12,030 | 402 | -59 R | Buried → Buried | none |
| M15-L-T2 | 12,030 | 552 | +74 R | Buried → Buried | none |
| M15-L-T3 | 12,030 | 606 | +172 R | Buried → Buried | none |
| M15-L-T123 | 12,030 | 606 | +154 R | Buried → Buried | none |
| M15-LS-N | 24,061 | 1,829 | +3,416 R | Buried → Buried | none |
| M15-LS-S | 24,061 | 1,570 | +2,757 R | Buried → Buried | none |
| M15-LS-T1 | 24,061 | 780 | -209 R | Buried → Buried | none |
| M15-LS-T2 | 24,061 | 1,033 | -42 R | Buried → Buried | none |
| M15-LS-T3 | 24,061 | 1,144 | +101 R | Buried → Buried | none |
| M15-LS-T123 | 24,061 | 1,144 | +121 R | Buried → Buried | none |
| H1-L-N | 2,865 | 600 | +777 R | Buried → Buried | gate 3 PASS → FAIL, gate 5 PASS → FAIL |
| H1-L-S | 2,865 | 515 | +704 R | Buried → Buried | gate 3 PASS → FAIL, gate 5 PASS → FAIL |
| H1-L-T1 | 2,865 | 265 | -6 R | Buried → Buried | none |
| H1-L-T2 | 2,865 | 359 | +89 R | Buried → Buried | gate 5 PASS → FAIL |
| H1-L-T3 | 2,865 | 411 | +204 R | Buried → Buried | gate 3 PASS → FAIL, gate 5 PASS → FAIL |
| H1-L-T123 | 2,865 | 411 | +173 R | Buried → Buried | gate 5 PASS → FAIL |
| H1-LS-N | 5,730 | 1,175 | +1,202 R | Buried → Buried | gate 5 PASS → FAIL |
| H1-LS-S | 5,730 | 993 | +1,135 R | Buried → Buried | gate 5 PASS → FAIL |
| H1-LS-T1 | 5,730 | 501 | -69 R | Buried → Buried | none |
| H1-LS-T2 | 5,730 | 675 | +62 R | Buried → Buried | none |
| H1-LS-T3 | 5,730 | 784 | +271 R | Buried → Buried | gate 5 PASS → FAIL |
| H1-LS-T123 | 5,730 | 784 | +245 R | Buried → Buried | none |
11Corrections
15 Oct 2026: the cause of the three hourly long-only variants that failed only validation (GX-H1-L-N, GX-H1-L-S, GX-H1-L-T3) changed from “No proven edge” to “Overfit”, the protocol's published name for a result that passes development and fails validation, so that the same case has the same name on every page. No number, gate or verdict changed. 14 Oct 2026, display only: values that round to zero were shown with a sign (“-0.00 R” or “+0.00 R”); they are now shown as 0.00 R. No number changed. 8 Oct 2026, the same evening, no result changed: the hole test in the Data notes now says that removing every trade open across a gap is biased against long-held winners, and the description of the 1-hour golden cross now says its verdict became Inconclusive after the data check. Before the run, two points of the specification were corrected and dated in it: the last bar is 16:57, not 17:00, and the clock fix above. 18 Oct 2026, navigation: added links to the new guide that compares all 11 gold strategy tests. No result changed. 22 Oct 2026, navigation: added a link to the new guide comparing trading costs across all our tests. No result changed. 22 Oct 2026, navigation: added a link to the new guide comparing trend following and mean reversion across all our tests. No result changed. 22 Oct 2026, navigation: added a link to the new guide comparing versions with and without a stop loss across our tests. No result changed.
+More tests and guides
- Best gold trading strategy
- Golden cross 1 hour backtest
- Gold opening range breakout backtest
- Golden cross backtest
- Ema 9 21 crossover backtest
- Did the stop loss help? This test next to the other with-and-without pairs
- Trend following vs mean reversion: this test next to the others of its style
- Free prop firm challenge calculator
- What all the backtests found so far
- The backtesting protocol
- How to backtest a trading strategy without fooling yourself
- Backtesting glossary