# Gold Tuesday hold after a Monday decline

One EUR 10,000 long-only XAUUSD CFD transfer test, 2016–2025, with a matched gold
buy-and-hold benchmark. This uses only the public SPY example in
[Quantified Strategies](https://quantifiedstrategies.substack.com/p/spy-trading-strategies-backtests):
buy after Monday falls at least 1% from Friday and exit Tuesday close. The paid
numbered rules were not read or reconstructed. Gold, UTC daily boundaries and
next-quote fills are explicit adaptations, not a replication of SPY performance.

## Frozen rules

`protocol.json` was frozen **before signal counts or returns** at
`2026-11-26T09:02:58.140704+00:00`. SHA-256:

`41a0b6bdcc34ef4958333374db19579feb21598c745a23dde38084df032d9dab`

- Use observed UTC Monday and Friday **BID daily closes** from genuine M5
  quotes. Friday is literally Monday minus three calendar days. Missing either
  date skips that week; there is no Thursday or previous-session fallback and
  no imputed bar. Inputs start in 2016; no 2015 warmup or position is used.
- Qualify when `MondayClose <= 0.99*FridayClose + epsilon`, where
  `epsilon = 1e-12*max(1,abs(MondayClose),abs(FridayClose))`. Exactly a 1% fall
  qualifies; the guard is far below one price point.
- Buy at the first observed M5 **OPEN** at or after Tuesday 00:00 UTC and
  strictly before Wednesday 00:00 UTC. A later first quote consumes the week
  as a missed entry window. Execution-bar high, low and close never select entry.
- Exit at the first observed opening quote at or after **Wednesday 00:00 UTC**,
  retaining pending exits across gaps. The deadline is calendar based, not
  24 hours after a delayed Tuesday fill. Pending exits execute before a new entry.
- One long position, no stop, profit target or additional filter. Remaining
  positions are forcibly closed at the last available 2025 close with costs and
  a distinct reason. No rule, clock, instrument or cost variants were selected
  using returns.

The first Monday, 4 January 2016, cannot qualify without an observed Friday
1 January close. A Thursday close from 2015 does not rescue that missing date.

## Account and costs

Gold contract: **100 ounces per lot**, minimum/step 0.01 lot. Entry uses ask plus
**USD 0.10 per ounce**, exit bid minus USD 0.10 per ounce. Commission is
USD 3.50 per lot per side. Historical bid/ask spreads remain included.

Entry exposure is capped at current EUR cash, floored to the lot step, reserving
entry commission:

`lots = floor(cashEUR / (100 * actualEntryUSDperOz / EURUSDask + 3.5 / EURUSDbid) / .01) * .01`

Actual entry price includes slippage. USD gains convert at EURUSD ask;
liabilities, fees and funding at bid. Long floating equity marks gold bid.
EURUSD conversion uses exact or backward-known quotes. Entry quote age must be
at most 900 seconds or that whole week is skipped; a later fresh quote does not
revive it. Exit and valuation staleness are retained and disclosed.

**Funding is an assumed 5% annual debit on absolute entry USD notional**, accrued
over actual calendar seconds/365. It is not measured historical swap or carry.
Cash interest is zero. This is CFD cash/P&L accounting, not physical gold in EUR.

Primary buy-and-hold fixes initial ounces at the first 2016 quote using the
same initial exposure/cost rules and closes at the final available 2025 close.
Its holding duration and financing differ from the active case. The separately
nested exposure-scaled passive diagnostic is **ex-post and synthetic**: scale
passive net P&L/costs around EUR 10,000 by the ratio of active to passive average
absolute EUR notional. Cash earns zero. It is fractional, not lot-deployable,
and not another tested strategy case. Exposure averages integrate previous
observed marks over elapsed intervals, including gaps.

## Reproduce

Python 3.12 and exact dependencies in `requirements.txt` were used:

```sh
python download_data.py --symbols XAUUSD EURUSD --period M5 --start-year 2016 --end-year 2025 --directory data --workers 3
python verify_data.py --require-raw
python -m unittest test_backtest -v
python backtest.py --data-dir data --out results
```

Preserve [EV Trading Labs](https://evtradelabs.com/data) attribution. These are
Dukascopy-derived distributor aggregates, not independently reconciled direct
bank tick exports or FTMO broker quotes. Copied manifests retain original
processed and annual-input hashes. Raw full M5 price files and annual caches are
excluded from downloads; the scripts recreate them subject to current provider
access. Local cache reuse is not a new download. See `data/README.md` and
`data_quality.json` for coverage and provenance.

## Audit and limits

`daily_bid_gold.csv` contains actual observed weekday inputs. `weekly_signals.csv`
contains every calendar Monday, its literal Friday, closes, qualification and
calendar availability/deadline; calendar audit rows are not fabricated price
bars. `strategy_weekly_events.csv` adds actual entry/exit and skip reasons.
Trade CSVs record signal prices, ounces, underlying execution bid/ask, modeled
fills, conversion quotes/timestamps, fees, funding and planned calendar exit.

Summary JSON/CSV, both daily curves, trade logs, exposure-scaled diagnostic and
four charts are included. Local runs write both sampled M5 account curves. The
public package includes the strategy M5 curve; the large passive M5 curve is
omitted for size and regenerated by `backtest.py`. Daily bar-end valuations are
assigned to the just-completed interval using a one-nanosecond boundary shift,
retaining a final bar ending exactly at 2026-01-01 in 2025-12-31 daily equity.

PF and win rate use closed net P&L including all costs. Sharpe uses calendar
returns, sqrt365 and zero risk-free rate. Daily and sampled M5 drawdowns omit
the intrabar tick path. Fixed 2016–2020 and 2021–2025 splits are retrospective
stability diagnostics, not pristine prospective out-of-sample evidence.

FTMO results are necessary-condition screens on one continuous account, not
formal passes. They retain first loss flags, maximum flat balance, first flat
target attainment and as-of-target 1-Step consistency using **total NET closed
profit including losing days**. The separate continuous 5% threshold is not a
fresh verification phase. Missing-midnight gaps require a first-quote Prague
balance approximation; actual broker swaps, tick equity and full phase/restart
conditions are not replayed. An ending loss does not alone prove a prior target
was absent.

`run_environment.json` records the actual execution interval, source/test/output
hashes and package versions. Synthetic tests cover literal dates, threshold
boundaries, causality, Tuesday cutoffs, calendar exits, delayed fills, gold lot
arithmetic and EUR cash reconciliation. `INDEPENDENT_QA.md` records separate
raw-data checks when completed. MT5 source is not claimed compiled or terminal
backtested; consult its notes. Original software is MIT licensed; sources,
market data and dependencies retain their own terms.
