# Gold at night, gold by day: the overnight effect on XAUUSD, 1-minute data - specification (RIP Backtest protocol v1.0 plus the 8 Oct 2026 rules)

Specification written and **frozen 2026-10-21 (approved by the owner the same day, draft 1 unchanged)**. No return of any session or hour has been computed for this test. Once frozen, any change of a rule is documented and treated as a separate test; bugs may be fixed.

## Why this test, where the claim comes from, and what was looked at before
- **Chosen by the owner** on 2026-10-21 from four gold proposals ("hai sa facem 1"): "the best time to trade gold".
- **The claim, from published work:** Blose and Gondhalekar (Applied Economics Letters, 2014, COMEX gold futures 1985-2012) report that gold's **overnight** returns (from the COMEX close to the next open) are significantly positive and its **day-session** returns significantly negative; a later paper with Kort (Journal of Economics and Finance, 2018) reports the same in spot gold, miners and gold funds, weaker in later years. The World Gold Council's 2026 mid-year outlook, as reported in the press, describes gains in Asian hours and drops in US hours. We test the COMEX framing because it is the one with fixed, published hours.
- **Hours fixed now, from the COMEX day session (not from our data):** day = **08:20 to 13:30 New York** (the COMEX gold floor session the papers' open and close refer to); night = **13:30 to 08:20 the next trading morning** (including weekends: Friday 13:30 to Monday 08:20). No other hours will be tried after the result.
- **Looked at before (disclosed):** our earlier gold tests published results by entry hour for their own signals (most recently the H1 Open Trap, 21 Oct 2026), and the noise-area and opening-range tests looked at sessions. None measured the plain return of holding gold in a fixed window; the raw hour-by-hour drift of this file has not been computed. The holdout is already used.

## Instrument and data
- **XAUUSD**, IC Markets MT4 demo, 1-minute bid history 2004 .. 2026-10-07 16:57 New York, **clock corrected** (`gx_lib.loadGold({ fix: true })`), since the rules depend on the time of day; minute stamps are close times.
- **Holes (rule 3):** `data_holes_xau.json`; trades open across a suspect or unclear gap are counted, and every gate and verdict is recomputed without them.

## Rules
- **Entry and exit at the open of the first existing minute at or after the stated New York time**, on the same calendar day (a window whose start or end minute does not exist that day, such as a holiday, is skipped; a night trade whose exit day has no 08:20 minute exits at the next day that has one).
- **GN-NIGHT-L:** buy at 13:30, sell at 08:20 the next trading morning. Every trading day.
- **GN-DAY-S:** sell short at 08:20, buy back at 13:30. Every trading day.
- **GN-LS:** both: long through the night, short through the day (two trades a day, booked separately).
- **Three variants.** One position per variant at a time (the windows do not overlap).

## Results, costs, financing
- **Unit:** net % of the entry price per trade. Also reported: dollars per ounce, by year, by weekday, the 13:30-to-17:00 and 18:00-to-08:20 parts of the night separately, and (descriptive only, not a gate, chosen after nothing) the average return of each hour of the day.
- **Costs:** $0.30 an ounce a round trip, as in every gold test on the site; slippage zero, which is optimistic. With two trades a day the cost is large relative to a small effect; that is part of the question.
- **Financing:** night trades cross the 17:00 rollover. Scenario A: 3% a year of the price per night held (longs pay, shorts earn nothing); scenario B: the IC Markets XAUUSD swap recorded on 2026-10-12 (long -57.03, short +39.767 points per lot per night, Wednesday counting three), not a historical swap. The verdict is that of the baseline (no financing); both scenarios are shown next to it.

## Periods, gates, control
- **Periods (by entry date):** development 2004 .. 2012; validation 2013 .. 2019; holdout 2020 .. 2026-10-07 (**already used**).
- **Six gates per variant:** validation profit factor >= 1.2; at least 50 trades in each period; development **t >= 2.0** (three variants of a strategy not tested before on the site); above the 95th percentile of 500 runs of the matched control; positive without the 10 best trades; holdout net positive (flagged used).
- **Matched control (other hours, same days):** every trade keeps its day, direction and length in minutes, and its start is moved by one random offset of whole minutes (at least 60 minutes, applied to all trades of a run, wrapping within the 24 hours), to the first existing minute at or after the new time. 500 runs, seeds 1000 + run. Statistic: average net % per trade. It asks whether these hours are better than other hours of the same days, which removes gold's long rise from the comparison.

## Engine and self-test (before the run)
New engine `gn_lib.js`, independent re-implementation `gn_ref.js`, `gn_selftest.js` that must pass before any result is printed: hand-worked days (entries and exits at the stated times, a missing start minute, a weekend night, a holiday, costs, both financing scenarios), the reference matched trade by trade on the real data for all three variants, the control at offset 0 reproducing the real trades.

## Before the article
Results go to the owner first: all three variants, every gate, by year, by weekday, the hour table, both financing scenarios, the hole check. One article, published only with the owner's agreement. Working title for search: "Best Time to Trade Gold? 22 Years of Minute Data, Night vs Day".

## Reading the result
"Buried" or "Inconclusive" mean a statistically convincing edge was not demonstrated; neither is proof that none exists. One broker's spot history, one definition of the sessions.
