# Gold overnight versus intraday — Edge Quant, 17 November 2026

This package tests two fixed session rules on XAUUSD, using an EUR10,000 CFD account and ten years of actual available Dukascopy-derived bid/ask observations (2016–2025). It adapts the public GLD baseline described by Quantified Strategies on 11 March 2026: https://quantifiedstrategies.substack.com/p/a-quantitative-look-at-the-gold-overnight . It does not reproduce the publisher's private filtered strategy, its ETF returns, or an MT5 Strategy Tester result.

## Reproduce the research

Use Python 3.11+ (the completed run used Python 3.12). From an isolated virtual environment and this package directory:

```sh
python -m pip install -r requirements.txt
python download_data.py --symbols XAUUSD EURUSD --period M5 --start-year 2016 --end-year 2025
python generate_calendar.py
python generate_mql_calendar.py
python backtest.py --data-dir data --sessions sessions.csv --out results
python verify_cached_data.py --data-directory data
python -m unittest discover -s . -p 'test_backtest.py'
```

The MQL calendar generator also checks the matching embedded source hash. If intentionally using a different calendar, update the EA expected hash as described in the MQL5 notes; do not silently mix calendars.

The supplied `sessions.csv` and manifests pin the calendar used for the report, so regeneration is optional when reproducing the frozen snapshot. Compare its SHA-256 before and after any regeneration. Full five-minute price files and the raw annual cache are fetched by the downloader, rather than duplicated in this ZIP. Raw and processed file hashes and original endpoints accompany the package. No extra indicator warmup is required for a clock-only rule.

Data attribution: Dukascopy ticks aggregated by EV Trading Labs, https://evtradelabs.com/data . This is explicitly an attributed third-party distributor, not a direct bank export or an FTMO broker series. The same verified cache used in the earlier study was retained. It contains 708,764 XAUUSD and 747,886 EURUSD M5 candles. The direct Dukascopy route had required AWS Requester Pays credentials that were unavailable; no other underlying price source was silently substituted. See `data/README.md`, per-symbol manifests and `data_quality.json` for coverage, hashes and limitations.

## Rules fixed before the run

Case A (overnight): buy gold at the scheduled US core-equity session close and sell at the next session's open. Case B (intraday): buy at that session's open and sell at its close. Otherwise hold EUR cash. Normal New York hours are 09:30–16:00; the calendar includes 13:00 early closes, DST, holidays and exceptional closures. This is an explicit adaptation of ETF session windows to a near-continuous gold CFD, not a claim that spot gold has an ETF opening or closing auction.

The XNYS calendar is generated by pinned third-party `exchange_calendars` 4.13.3. Official NYSE/ICE publications verify the core hours, early closes and presidential mourning closures. The corresponding Arca core session is used as the GLD clock proxy. Calendar coverage is 2015–2030; future unannounced closures require regeneration. The calendar generator and source manifest are included. `XNYS_Sessions.mqh` embeds the same calendar for MQL5.

Entry uses the first available M5 gold opening quote at or after the scheduled event, allowing at most 15 minutes delay. Missed or excessively delayed entries are skipped; an existing position exits at the first available opening quote at or after its planned exit, with any delay disclosed. Entry decisions do not inspect future exit availability or returns. Entries with planned exit outside the evaluation window are skipped. There is at most one position per independent case.

Account: EUR10,000, no cash interest, long-only, no extra leverage and no protective stop. Each entry uses at most 1x then-current equity notional, with 100 oz/lot, 0.01 lot step/minimum, rounding down and reserving entry commission. Entry fills at ask+$0.10/oz; exit at bid−$0.10/oz. Commission is$3.50/lot per side. USD profits convert at EURUSD ask, liabilities at bid. The account holds EUR cash plus converted CFD P&L; USD principal is not itself converted into an unhedged physical-gold holding.

Financing is an assumption: 5% annually on entry USD notional over actual elapsed calendar time/365, including weekends. It is not a measured historical swap series, does not reproduce triple rollover, and accrues even intraday in this continuous carrying-cost model. Actual broker results can differ. Cash interest is zero. All accounts use the same fixed cost conventions; there is no tuning after seeing results.

Benchmark: buy-and-hold gold CFD with fixed initial ounces, first available 2016 entry and final available 2025 close. It has comparable initial notional and the same price/cost framework, but different time in the market and turnover. This is not a physical bullion or gold ETF total-return benchmark. EURUSD alignment uses only exact contemporaneous quotes or already observed previous closes; stale observations are disclosed and cannot certify broker mark-to-market precision.

## Metrics and evidence limits

Net trade P&L includes execution costs, commission and funding. Profit Factor is positive net trade P&L divided by absolute negative net trade P&L. A winning single-trade benchmark has undefined trade PF and cannot establish a stable win rate. Daily Sharpe uses all calendar days, zero risk-free rate and sqrt(365) annualization. Headline drawdown and Recovery Factor use calendar daily equity, with sampled M5-close drawdown reported separately. Recovery Factor is net EUR profit divided by maximum absolute EUR drawdown. CAGR uses the full test duration.

The fixed 2016–2020 and 2021–2025 diagnostic slices are reported without fitting or parameter changes. The source was published in 2026, after the entire historical evaluation period. Consequently neither slice is a pristine prospective out-of-sample validation of this strategy-selection decision; they are retrospective stability diagnostics. No research result is a live track record.

FTMO 1-Step and 2-Step screens follow the official objectives checked 17 November 2026: https://ftmo.com/en/trading-objectives/ . They screen a single continuous modeled account and sampled equity, with approximate Prague-midnight balances; they do not certify tick compliance or simulate every evaluation phase reset. A sampled static-floor breach can reject the tested continuous path under the model, while absence of a sampled breach does not establish a pass. Actual historical broker swaps, fees, intrabar prices and program-specific rules remain necessary. Current 1-Step Consistency for new orders from 12 October 2026 uses the best closed-profit day divided by total NET closed profit, including losing days. One-step and two-step loss floors differ. See the report JSON and article for the actual flags and dates.

## MQL5 source status

Install `GoldSessionEffect.mq5` with its supplied `XNYS_Sessions.mqh` dependency and follow `MQL5_NOTES.md`. The EA source was reviewed but not compiled or run in MT5 in this environment. Its broker contract size, fills, swaps and UTC/server time must be aligned before comparing tests. The supplied research costs are not artificially charged by the EA; MT5 uses broker settings. Publishing source is not an instruction to execute live trades.

Original code: MIT license. Third-party quote data, exchange calendar implementation and cited publications retain their source rights; this license does not relicense them.
