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.

XAUUSD spot (broker data) · 15-minute and 1-hour bars, 24 hours · Protocol v1.0 plus the 8 Oct 2026 rules

Buried · No proven edge

Passed five gates on the hourly chart. Validation said no.

BornRules, variants, costs and gates frozen 8 Oct 2026 (gx_spec.md), before any EMA 9/20 value was computed on gold
Died8 Oct 2026

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.

VariantTradesNet after costsR per tradeGross, before costs$ per ounceWinners (95% range)Profit factorDrawdown incl. open lossesVerdict
H1-L-N2,865+610 R+0.21 R+810.1 R+$3,626886 of 2865 (29% to 33%)1.29-57.0 RBuried
H1-L-S2,865+529 R+0.18 R+729.6 R+$3,326783 of 2865 (26% to 29%)1.29-55.9 RBuried
H1-L-T12,865-74 R-0.03 R+126.0 R-$4131358 of 2865 (46% to 49%)0.95-91.5 RBuried
H1-L-T22,865+75 R+0.03 R+274.8 R+$267949 of 2865 (31% to 35%)1.04-63.3 RBuried
H1-L-T32,865+179 R+0.06 R+379.6 R+$1,096828 of 2865 (27% to 31%)1.10-52.7 RBuried
H1-L-T1232,865+60 R+0.02 R+260.2 R+$3171057 of 2865 (35% to 39%)1.04-61.2 RBuried
H1-LS-N5,730+469 R+0.08 R+870.3 R+$3,5261653 of 5730 (28% to 30%)1.11-91.7 RBuried
H1-LS-S5,730+481 R+0.08 R+882.4 R+$2,8111448 of 5730 (24% to 26%)1.13-66.0 RBuried
H1-LS-T15,730-280 R-0.05 R+121.8 R-$1,6422660 of 5730 (45% to 48%)0.90-294.3 RBuried
H1-LS-T25,730-108 R-0.02 R+293.3 R-$3741809 of 5730 (30% to 33%)0.97-142.8 RBuried
H1-LS-T35,730+118 R+0.02 R+519.2 R+$1,1701562 of 5730 (26% to 28%)1.03-97.2 RBuried
H1-LS-T1235,730-90 R-0.02 R+311.4 R-$2822007 of 5730 (34% to 36%)0.97-119.9 RBuried
M15-L-N12,030-697 R-0.06 R+1191.2 R-$6933247 of 12030 (26% to 28%)0.93-1058.1 RBuried
M15-L-S12,030-828 R-0.07 R+1060.4 R-$1,1332789 of 12030 (22% to 24%)0.91-1144.2 RBuried
M15-L-T112,030-1,941 R-0.16 R-52.5 R-$4,2535336 of 12030 (43% to 45%)0.70-1954.9 RBuried
M15-L-T212,030-1,664 R-0.14 R+224.2 R-$3,6163695 of 12030 (30% to 32%)0.79-1733.2 RBuried
M15-L-T312,030-1,476 R-0.12 R+412.2 R-$2,9233154 of 12030 (25% to 27%)0.83-1594.0 RBuried
M15-L-T12312,030-1,694 R-0.14 R+194.6 R-$3,5974047 of 12030 (33% to 34%)0.76-1739.6 RBuried
M15-LS-N24,061-2,774 R-0.12 R+1025.7 R-$5,1136134 of 24061 (25% to 26%)0.87-2979.4 RBuried
M15-LS-S24,061-2,610 R-0.11 R+1190.0 R-$4,7435276 of 24061 (21% to 22%)0.86-2817.5 RBuried
M15-LS-T124,061-4,038 R-0.17 R-238.0 R-$8,28310663 of 24061 (44% to 45%)0.69-4069.0 RBuried
M15-LS-T224,061-3,815 R-0.16 R-15.1 R-$7,9717238 of 24061 (30% to 31%)0.77-3863.2 RBuried
M15-LS-T324,061-3,608 R-0.15 R+191.8 R-$7,1526077 of 24061 (25% to 26%)0.79-3690.9 RBuried
M15-LS-T12324,061-3,820 R-0.16 R-20.4 R-$7,8027924 of 24061 (32% to 34%)0.73-3864.5 RBuried
-1,000-500050020062008201020122014201620182020202220242026validationholdout*H1-L-NH1-LS-NM15-L-N

Cumulative net R by month for three variants. * Holdout already used before this test.

Net R by period

VariantDevelopment 2004 to 2012Validation 2013 to 2019Holdout* 2020 to 2026Development tValidation PF
H1-L-N+327 R+32 R+251 R3.801.05
H1-L-S+253 R+44 R+232 R3.281.07
H1-L-T1+7 R-60 R-21 R0.200.87
H1-L-T2+103 R-49 R+21 R2.290.91
H1-L-T3+153 R-38 R+65 R2.830.94
H1-L-T123+87 R-49 R+22 R2.160.90
H1-LS-N+234 R+58 R+176 R1.991.04
H1-LS-S+158 R+129 R+194 R1.521.10
H1-LS-T1-132 R-69 R-79 R-2.950.92
H1-LS-T2-25 R-63 R-21 R-0.390.94
H1-LS-T3+87 R-1 R+32 R1.151.00
H1-LS-T123-23 R-44 R-23 R-0.410.95
M15-L-N-342 R-492 R+136 R-1.800.85
M15-L-S-371 R-546 R+88 R-2.240.81
M15-L-T1-885 R-765 R-291 R-12.930.64
M15-L-T2-748 R-734 R-182 R-8.200.72
M15-L-T3-649 R-693 R-134 R-6.090.75
M15-L-T123-761 R-731 R-202 R-9.260.69
M15-LS-N-1,549 R-728 R-498 R-5.750.89
M15-LS-S-1,461 R-729 R-420 R-6.310.87
M15-LS-T1-1,976 R-1,362 R-700 R-20.630.67
M15-LS-T2-1,825 R-1,316 R-673 R-14.330.75
M15-LS-T3-1,788 R-1,203 R-616 R-12.030.78
M15-LS-T123-1,863 R-1,294 R-663 R-16.320.72

04Stops, targets, longs and shorts

Exit rule1-hour, long only1-hour, long and short15-minute, long only15-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 RShort 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.

VariantTradesReal average per tradeControl medianControl 5th to 95thPercentile (95 needed)
H1-L-N2,865+0.21 R+0.07 R+0.02 R to +0.13 R100.0
H1-L-S2,865+0.18 R+0.01 R-0.03 R to +0.06 R100.0
H1-L-T12,865-0.03 R-0.06 R-0.09 R to -0.04 R99.2
H1-L-T22,865+0.03 R-0.05 R-0.08 R to -0.01 R100.0
H1-L-T32,865+0.06 R-0.03 R-0.06 R to +0.01 R100.0
H1-L-T1232,865+0.02 R-0.05 R-0.08 R to -0.01 R100.0
H1-LS-N5,730+0.08 R-0.06 R-0.11 R to 0.00 R100.0
H1-LS-S5,730+0.08 R-0.03 R-0.07 R to 0.00 R100.0
H1-LS-T15,730-0.05 R-0.07 R-0.09 R to -0.05 R95.4
H1-LS-T25,730-0.02 R-0.06 R-0.09 R to -0.04 R100.0
H1-LS-T35,730+0.02 R-0.06 R-0.08 R to -0.03 R100.0
H1-LS-T1235,730-0.02 R-0.06 R-0.09 R to -0.04 R100.0
M15-L-N12,030-0.06 R-0.09 R-0.12 R to -0.06 R93.2
M15-L-S12,030-0.07 R-0.11 R-0.14 R to -0.09 R100.0
M15-L-T112,030-0.16 R-0.14 R-0.16 R to -0.13 R0.6
M15-L-T212,030-0.14 R-0.14 R-0.16 R to -0.13 R57.6
M15-L-T312,030-0.12 R-0.14 R-0.15 R to -0.12 R94.0
M15-L-T12312,030-0.14 R-0.14 R-0.15 R to -0.13 R51.2
M15-LS-N24,061-0.12 R-0.15 R-0.18 R to -0.12 R98.2
M15-LS-S24,061-0.11 R-0.14 R-0.15 R to -0.12 R100.0
M15-LS-T124,061-0.17 R-0.15 R-0.16 R to -0.14 R0.2
M15-LS-T224,061-0.16 R-0.15 R-0.17 R to -0.14 R23.6
M15-LS-T324,061-0.15 R-0.15 R-0.16 R to -0.14 R56.2
M15-LS-T12324,061-0.16 R-0.15 R-0.16 R to -0.14 R19.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

VariantTrades1. PF ≥ 1.2 in validation2. ≥ 50 trades in each period3. t ≥ 2.5 on development4. Above the 95th percentile of the shifted-state control5. Positive without the 10 best trades6. Holdout net positive (already used)
H1-L-N2,865failpasspasspasspasspass
H1-L-S2,865failpasspasspasspasspass
H1-L-T12,865failpassfailpassfailfail
H1-L-T22,865failpassfailpasspasspass
H1-L-T32,865failpasspasspasspasspass
H1-L-T1232,865failpassfailpasspasspass
H1-LS-N5,730failpassfailpasspasspass
H1-LS-S5,730failpassfailpasspasspass
H1-LS-T15,730failpassfailpassfailfail
H1-LS-T25,730failpassfailpassfailfail
H1-LS-T35,730failpassfailpasspasspass
H1-LS-T1235,730failpassfailpassfailfail
M15-L-N12,030failpassfailfailfailpass
M15-L-S12,030failpassfailpassfailpass
M15-L-T112,030failpassfailfailfailfail
M15-L-T212,030failpassfailfailfailfail
M15-L-T312,030failpassfailfailfailfail
M15-L-T12312,030failpassfailfailfailfail
M15-LS-N24,061failpassfailpassfailfail
M15-LS-S24,061failpassfailpassfailfail
M15-LS-T124,061failpassfailfailfailfail
M15-LS-T224,061failpassfailfailfailfail
M15-LS-T324,061failpassfailfailfailfail
M15-LS-T12324,061failpassfailfailfailfail

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.

VariantBaseline nettA: 3% a year, nettA: gates failedB: current swap, nettB: gates failed
H1-L-N+610 R4.12+513 R3.521+29 R0.211, 3, 5
H1-L-S+529 R3.92+446 R3.361+40 R0.321, 3, 5
H1-L-T1-74 R-1.45-97 R-1.881, 3, 5, 6-207 R-3.991, 3, 5, 6
H1-L-T2+75 R1.04+39 R0.541, 3-133 R-1.861, 3, 5, 6
H1-L-T3+179 R2.09+133 R1.551-93 R-1.091, 3, 5
H1-L-T123+60 R0.93+25 R0.391, 3, 5-144 R-2.261, 3, 5, 6
H1-LS-N+469 R2.36+291 R1.481, 3+229 R1.171, 3, 5
H1-LS-S+481 R2.68+331 R1.871, 3+271 R1.541, 3
H1-LS-T1-280 R-3.87-321 R-4.441, 3, 5, 6-331 R-4.571, 3, 4, 5, 6
H1-LS-T2-108 R-1.07-175 R-1.731, 3, 5, 6-193 R-1.911, 3, 5, 6
H1-LS-T3+118 R0.97+32 R0.271, 3, 5+4 R0.031, 3, 5
H1-LS-T123-90 R-1.00-155 R-1.721, 3, 5, 6-174 R-1.921, 3, 5, 6
M15-L-N-697 R-2.33-895 R-3.021, 3, 4, 5-1,737 R-6.031, 3, 4, 5, 6
M15-L-S-828 R-3.14-993 R-3.791, 3, 5-1,697 R-6.681, 3, 5, 6
M15-L-T1-1,941 R-18.27-1,994 R-18.781, 3, 4, 5, 6-2,269 R-21.211, 3, 4, 5, 6
M15-L-T2-1,664 R-11.55-1,749 R-12.161, 3, 4, 5, 6-2,125 R-14.771, 3, 4, 5, 6
M15-L-T3-1,476 R-8.72-1,579 R-9.351, 3, 4, 5, 6-2,000 R-11.881, 3, 4, 5, 6
M15-L-T123-1,694 R-13.14-1,774 R-13.791, 3, 4, 5, 6-2,132 R-16.571, 3, 4, 5, 6
M15-LS-N-2,774 R-6.31-3,150 R-7.201, 3, 5, 6-3,132 R-7.161, 3, 5, 6
M15-LS-S-2,610 R-6.68-2,921 R-7.521, 3, 5, 6-2,906 R-7.481, 3, 5, 6
M15-LS-T1-4,038 R-26.89-4,141 R-27.571, 3, 4, 5, 6-4,137 R-27.451, 3, 4, 5, 6
M15-LS-T2-3,815 R-18.78-3,976 R-19.591, 3, 4, 5, 6-3,965 R-19.511, 3, 4, 5, 6
M15-LS-T3-3,608 R-15.11-3,803 R-15.951, 3, 4, 5, 6-3,777 R-15.831, 3, 4, 5, 6
M15-LS-T123-3,820 R-21.08-3,974 R-21.961, 3, 4, 5, 6-3,960 R-21.841, 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

VariantCauseGates failedVerdict
H1-L-NOverfit1Buried
H1-L-SOverfit1Buried
H1-L-T1Costs1, 3, 5, 6Buried
H1-L-T2No proven edge1, 3Buried
H1-L-T3Overfit1Buried
H1-L-T123No proven edge1, 3Buried
H1-LS-NNo proven edge1, 3Buried
H1-LS-SNo proven edge1, 3Buried
H1-LS-T1Costs1, 3, 5, 6Buried
H1-LS-T2Costs1, 3, 5, 6Buried
H1-LS-T3No proven edge1, 3Buried
H1-LS-T123Costs1, 3, 5, 6Buried
M15-L-NCosts1, 3, 4, 5Buried
M15-L-SCosts1, 3, 5Buried
M15-L-T1No proven edge1, 3, 4, 5, 6Buried
M15-L-T2Costs1, 3, 4, 5, 6Buried
M15-L-T3Costs1, 3, 4, 5, 6Buried
M15-L-T123Costs1, 3, 4, 5, 6Buried
M15-LS-NCosts1, 3, 5, 6Buried
M15-LS-SCosts1, 3, 5, 6Buried
M15-LS-T1No proven edge1, 3, 4, 5, 6Buried
M15-LS-T2No proven edge1, 3, 4, 5, 6Buried
M15-LS-T3Costs1, 3, 4, 5, 6Buried
M15-LS-T123No proven edge1, 3, 4, 5, 6Buried

“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

Frozen specificationRules, variants, costs, scenarios, gates, control, the data audit. Dated before any EMA 9/20 value was computed on gold.
gx_spec.md
CodeData loader and clock fix, runner, self-test, reproduction check and the shared engine. The run needs your own MT4 history.
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
ResultsSelf-test, reproduction, the console output of the run and all numbers as one file.
gx_selftest_result.txt · gx_repro_result.txt · gx_results.txt · gx_summary.json
Trade logs (CSV)Every trade of every variant, with net R in the baseline and in both scenarios.
1-hour · 15-minute
Data recordClock check, data audit, list of gaps, file hashes and the hole test.
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.
YearOne-minute bars per weekdaySuspect or unclear gaps
2004568279
2005558419
2006662313
2007941245
20081,223200
20091,281128
20101,237421
20111,262306
20121,284303
20131,35138
20141,35122
20151,34428
20161,35822
20171,35817
20181,35518
20191,35524
20201,35616
20211,3617
20221,3680
20231,3731
20241,3730
20251,36412
20261,34881

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.

VariantTradesAcross a holeNet of thoseVerdictGate changes
M15-L-N12,030956+1,959 RBuried → Buriednone
M15-L-S12,030827+1,623 RBuried → Buriednone
M15-L-T112,030402-59 RBuried → Buriednone
M15-L-T212,030552+74 RBuried → Buriednone
M15-L-T312,030606+172 RBuried → Buriednone
M15-L-T12312,030606+154 RBuried → Buriednone
M15-LS-N24,0611,829+3,416 RBuried → Buriednone
M15-LS-S24,0611,570+2,757 RBuried → Buriednone
M15-LS-T124,061780-209 RBuried → Buriednone
M15-LS-T224,0611,033-42 RBuried → Buriednone
M15-LS-T324,0611,144+101 RBuried → Buriednone
M15-LS-T12324,0611,144+121 RBuried → Buriednone
H1-L-N2,865600+777 RBuried → Buriedgate 3 PASS → FAIL, gate 5 PASS → FAIL
H1-L-S2,865515+704 RBuried → Buriedgate 3 PASS → FAIL, gate 5 PASS → FAIL
H1-L-T12,865265-6 RBuried → Buriednone
H1-L-T22,865359+89 RBuried → Buriedgate 5 PASS → FAIL
H1-L-T32,865411+204 RBuried → Buriedgate 3 PASS → FAIL, gate 5 PASS → FAIL
H1-L-T1232,865411+173 RBuried → Buriedgate 5 PASS → FAIL
H1-LS-N5,7301,175+1,202 RBuried → Buriedgate 5 PASS → FAIL
H1-LS-S5,730993+1,135 RBuried → Buriedgate 5 PASS → FAIL
H1-LS-T15,730501-69 RBuried → Buriednone
H1-LS-T25,730675+62 RBuried → Buriednone
H1-LS-T35,730784+271 RBuried → Buriedgate 5 PASS → FAIL
H1-LS-T1235,730784+245 RBuried → Buriednone

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