# Golden cross (50 / 200) on ES and gold - frozen specification (RIP Backtest protocol v1.0 plus the 8 Oct 2026 rules)

Specification written **2026-10-08, before any moving average, signal or trade of this test was computed.** What was looked at before writing it: the ThinkMarkets article quoted below;
the first and last row of the ES 1-minute file (2020-01-01 18:01 close 4045, 2026-09-25 16:59 close 7805.75, to know the date range); the folder names of the NinjaTrader daily database;
the loaders and statistics of the existing engines. No daily bar, moving average, cross, return or equity curve was looked at. From general knowledge, not from our data, the author expects the
50-day average of the S&P 500 to have crossed the 200-day average only a few times between 2020 and 2026; that expectation is the reason for the "too few trades" rule below.
Bugs may be fixed after the run; rules may not. If the engine fails its self-test (below), nothing is run.

## What is being tested, and where the rule comes from
Source: ThinkMarkets, "Golden cross pattern explained" (published 16 Feb 2026, read 8 Oct 2026).
- Definition: "a short-term moving average crosses above a long-term moving average"; the most watched version is the **50-day moving average crossing above the 200-day**.
- Use: "Think of the gold cross as the entry and the death cross as the exit" (the death cross is the 50-day falling below the 200-day). The article adds that the death cross is used "to manage exits,
  hedges, or short setups".
- Average type: the SMA is "most common for the golden cross, but some use EMA golden crosses". Both are tested.
- Claims quoted by the article (we have NOT checked the studies behind them): Fidelity, average gain of 14% after the 50-day crosses above the 200-day on the S&P 500; Quantified Strategies, 79% winning trades;
  the golden-cross-in / death-cross-out rule "73% success rate on equity indices".
- **Not tested, and why:** the article's confirmations (volume expansion, RSI above 50, MACD alignment, Stochastic turns) and its breakout, pullback and mean-reversion entries. They are discretionary
  ("decisive breakout", "measured pullback", "bullish confirmation candle", "at least two confirmations") with no numbers, and each would add variants to a sample that is already very small.
  What is tested is the bare rule the article defines: buy the golden cross, sell the death cross.

## Instruments and data
- **ES**: E-mini S&P 500 futures, back-adjusted continuous 1-minute file (`ES_1min.csv`, New York close-time stamps), 2020-01-01 to 2026-09-25. $50 per point.
- **Gold**: XAUUSD spot (broker data, not futures), MT4 1-minute history of the IC Markets demo server, converted to New York time as in the gold and FX tests (server time = New York + 7 hours), June 2004 to October 2026.
- Daily bars are built from the 1-minute bars. **A trading day runs from 17:00 New York to 17:00 New York** (the futures session break; the same as the MT4 server calendar day). The day's close is the close of its last
  1-minute bar. A day with fewer than 30 one-minute bars is not counted as a day (the number dropped is reported). The 50 and 200 count trading days as built, not calendar days.

## Rules (one position at a time, one contract / one ounce)
- Fast = 50-day, slow = 200-day moving average of the daily closes. SMA, or EMA with alpha = 2/(N+1) seeded with the simple average of the first N closes. Signals start on the first day both exist.
- **Golden cross** on day d: fast[d] > slow[d] and fast[d-1] <= slow[d-1]. **Death cross**: fast[d] < slow[d] and fast[d-1] >= slow[d-1]. Evaluated on the daily close.
- Fill: the **open of the first 1-minute bar after the signal day's last bar** (the next session open), plus costs below. Signals on the last day of the data have no fill.
- If the averages are already in the golden state on the first day both exist, no trade is opened until the next cross (a position needs an observed cross).
- A position still open on the last bar is closed at that bar's close with exit costs and flagged "open at end of data" (marked to market, included in every statistic).
- Reversals (long-short variants) close the old position and open the new one at the same fill; each leg is its own trade with its own costs.

## Variants (declared up front; the ONLY ones tested): 4 per market, 8 in total
- **GC-L-SMA**: long on the golden cross, flat on the death cross (the article's rule).
- **GC-LS-SMA**: long on the golden cross, short on the death cross, always in the market after the first cross.
- **GC-L-EMA**, **GC-LS-EMA**: the same with exponential averages.
No stops and no targets (the article's rule has none). No other parameters will be tried after seeing results (no 20/100, no 10/50).

## Costs
- **ES**: commission $5.76 per round trip plus one tick (0.25 point, $12.50) of slippage on every fill = $30.76 per trade, as in all the ES tests. **Roll cost**: a position held across a quarterly roll pays the same
  $30.76 per roll. Roll dates are the second Thursday of March, June, September and December; a roll is charged for each such date on which the position is held at the daily close. The back-adjusted series already
  carries the price effect of the roll.
- **Gold**: $0.30 per ounce per round trip, as in the gold test. **Overnight financing is not in the baseline** (the broker's swap rates are not known and they changed with interest rates over 22 years). Because trades last months,
  it is reported as a **sensitivity**: the same trades with 3% per year of notional charged for every calendar day held, both directions (an assumption, not a measured broker rate). The verdict uses the baseline; the sensitivity is shown beside it.
- Costs are tiny relative to the size of the trades (about 0.02% of ES notional, about 0.01% of the gold price), so "Costs" cannot be the cause of a failure here.

## Units
- **ES**: gates and statistics use **net dollars per contract**, as in every other ES test. The level of a back-adjusted series is not the real index level (in 2020 it sits well above the real price, because the
  roll gaps are stripped out), so a percentage of the adjusted entry price would be distorted; percentages for ES are reported only as a labelled approximation.
- **Gold**: gates and statistics use the **net return per trade as a percentage of the entry price** (non-compounded, one unit), because the price level moved from about $400 to several thousand dollars and a dollar
  in 2005 is not a dollar in 2025. Dollars per ounce are reported next to it.
- Profit factor, t-statistic, win rate and drawdown are computed on these units.
- Back-adjustment also means the 50-day and 200-day averages of ES are averages of an adjusted series, so the dates of the crosses can differ by days from the dates on the S&P 500 index or on an unadjusted
  continuous chart. That limitation applies to every ES result.

*Revision note (same day, before any run):* the first draft of this section used a percentage of the entry price for both markets; it was changed to dollars for ES for the reason above. Nothing had been computed.

## Periods (by entry date)
- ES: Development 2020-01-01 .. 2023-12-31; Validation 2024-01-01 .. 2025-03-31; Holdout 2025-04-01 .. end of data. **The holdout is not clean** (the same ES data was used in earlier tests); it is reported and flagged as used.
- Gold: Development 2004-01-01 .. 2012-12-31; Validation 2013-01-01 .. 2019-12-31; Holdout 2020-01-01 .. end of data. **Not clean** (earlier gold tests used it).
- The 200-day warm-up means no ES signal exists before about October 2020 and no gold signal before about spring 2005.

## Gates (net of costs, per variant and market)
1. Profit factor >= 1.2 in validation. 2. At least 50 trades in each period. 3. Development t-statistic >= **2.5** (more than four variants of this strategy are tried in total across the two markets,
so the stricter bar from the 7 Oct 2026 rule applies). 4. Above the 95th percentile of 500 random runs of the matched control below (average net return per trade over the full sample).
5. Positive after removing the 10 best trades. 6. Holdout net positive (flagged used). All six are computed and printed for every variant.

## The sample-size rule (decided now, because the author expects it to matter)
A 50/200 cross on one market produces a handful of trades per decade, so gate 2 cannot be met by any variant here. A failed gate on a handful of trades is not evidence against anything, so:
**a variant with fewer than 30 trades in the full sample gets the verdict Inconclusive, whatever its gates show** (the protocol's definition: "not enough data or trades to decide either way"). The gates are still
printed, marked as uninformative for such variants. With 30 or more trades the usual rule applies: Buried (any gate failed) or Survivor (all six). "Inconclusive" is not "no edge": it means the data cannot say.
Thirty is a standard rule of thumb for a t-statistic to be worth reading; it is far below the protocol's own 50 per period.

## Matched random control (rule of 8 Oct 2026: matched on the signal's entry state)
The real **state series** (fast above slow = +1, below = -1, on every day both averages exist) is **circularly shifted** by a random offset of at least 5% of its length and applied to the real prices, with the same
cross rules, fills, costs and first-state rule. This keeps the number, spacing and length of the up and down episodes and moves them to random dates, so a market drift cannot be mistaken for skill. 500 runs, fixed seeds
(1000 + run number). The statistic is the average net return per trade; runs with no trade are excluded. The one seam where the end of the series meets its start can add or remove a sign change; the real series has no seam.

## Always reported, whatever the verdict
- Every trade (entry and exit date and price, days held, net %, net dollars, worst open loss in %, whether it was still open).
- Win rate with its 95% Wilson interval, average winner and loser, time in the market, and buy-and-hold over the same span (first signal day to last bar) for context (it is not a gate).
- Drawdown on closed trades and including open losses.
- The same statistics next to the article's three quoted numbers (14%, 79%, 73%), with the plain statement that they come from long histories and ours is short, so they can be neither confirmed nor refuted here.
- The number of years of data that would be needed to reach 50 trades at the observed rate of crosses.

## Before anything is run (self-test)
`ma_selftest.js` must pass before `ma_run.js` is allowed to touch the data: (1) rolling SMA and EMA match a naive recomputation to 1e-9 on the real closes; (2) hand-computed synthetic series give the exact expected
trades for all four variants, including the first-state rule, a reversal, an open trade at the end of data, and a known net after costs; (3) data checks: no duplicate day, roughly 245-262 days per full year, the fill is always the
minute directly after the signal day's last bar, and every ES daily close equals the 1-minute close at 17:00 (or the last bar before the break). No result is printed by the self-test.

### Self-test outcome (recorded 2026-10-08, before the run)
All checks passed (`ma_selftest_result.txt`). One data fact was found and is part of the specification from here on: the gold broker history has **holes** (days with fewer than 30 one-minute bars, not counted as days by the
rule above): 2 January 2006, 4 July 2006, 20 December 2010 to 13 January 2011, and 6 to 22 March 2012 (34 weekdays in all). The 50 and 200 count the days that exist, so around a hole the windows span a few more calendar
days than usual; a fill that lands on a hole day is flagged in the trade list. ES has no whole-day holes (wording corrected 8 Oct 2026: a later audit found shorter holes inside days, listed in data_manifest.md and in the Data notes of the post; no rule or result changed). The first draft of the "245-262 days per year" check did not count hole days and failed for gold 2012 (244); it was corrected to
count them, and the holes listed. No rule was changed and no result had been computed.

### Run log and additions after the first run (2026-10-08)
`ma_run.js` was run once with the rules above; the counts and trades did not change afterwards. After seeing the first output, three **descriptive** lines were added to the report, none of which
touches a gate or a verdict: total dollars per contract / per ounce, the compounded growth of the gold trades, and the worst peak-to-trough of the *daily marked-to-market equity* in the same dollar units as
buy and hold (the sum of per-trade percentages cannot be compared with a single buy-and-hold percentage). The re-run reproduced every earlier line exactly.

## Reading the result
"Inconclusive" and "no proven edge" mean a statistically convincing edge was not demonstrated; neither is proof that none exists. ES results are one back-adjusted futures series; gold results are one broker's spot history. A
50/200 cross is a slow rule and a six-year ES sample covers roughly one full market cycle.

### Terminology note (added 2026-10-08, after outside review; no rule changed)
Where this specification says "matched random control", the benchmark of the daily test is a **circularly shifted state-series control**: the real up and down state series of the two averages is shifted by a random offset of at least 5% of its length and the same rules, prices and costs are applied (not a random-entry test).
