# FX gap fade after long observed quote intervals

Two independent hypothetical EUR 10,000 accounts, EURUSD and GBPUSD, evaluated
2016-01-01 through 2025-12-31 UTC. Each has a separate long buy-and-hold CFD
benchmark. The four plotted series are not a combined portfolio.

The [Quantified Strategies public note](https://substack.com/@quantifiedstrategies/note/c-313266239)
provides the daily-gap idea. It does not specify the clock needed to reproduce
all daily observations. This study instead uses a frozen subset of long observed
quote absences. It does not reproduce the source's claimed statistics and does
not establish that every observed absence was an actual market closure.

## Frozen protocol

`protocol.json` was recorded at `2026-11-24T09:16:18.351260+00:00`, before the
first historical strategy run. SHA-256:

`71ae597b27937b35af99d394e3498e7dd235cedb58ca673b4a89bb19c4a1f21c`

`protocol.sha256` stores the checksum. The engine validates it before processing.
No parameter, pair, clock, or cost variant is selected using performance.

1. Take consecutive actual M5 opening timestamps at least 24 hours apart.
2. Subtract the prior completed BID close from the current reopening BID open.
   Trade if the absolute difference is **at least 5 pips**, including equality.
   One pip is 0.0001 for both selected pairs. A 1e-12 relative numerical guard
   prevents floating-point cancellation from missing exact equality.
3. Fade the gap: positive means short; negative means long. Enter at that same
   reopening opening quote, using ask for buys and bid for sells, plus adverse
   execution slippage. Current high, low, and close never select the entry.
   This is an explicit **zero-latency opening-quote assumption**.
4. Exit at the first observed opening quote at or after actual entry plus one
   hour. No stop, profit target, weekday, trend, or holiday filter. Retain delayed
   exits over quote gaps. A pending exit executes before a new gap entry at the
   same quote.
5. Require an exact or backward-known EURUSD conversion quote no more than
   900 seconds old at entry. Otherwise skip the entire gap and record it. Stale
   exit and valuation conversion quotes remain in the model and are disclosed.

2015 observations provide prior completed quotes; there is no indicator warmup.
Missing raw quotes are never imputed. Every observed interval of at least 24
hours is exported, including gaps below the threshold and skipped entries.

## Execution and EUR account

- Actual historical bid/ask prices, plus 0.1 pip adverse slippage on each leg.
- USD 3.50 per 100,000 base-currency lot per side; lot step/minimum 0.01.
- At most 1x initial EUR notional per entry, with entry commission reserved:
  `lots = floor(cashEUR / (100000 * actualEntryPrice / EURUSDask + 3.5 / EURUSDbid) / .01) * .01`.
  Actual entry price already includes slippage. One position per pair account.
- Positive USD P&L converts at EURUSD ask; negative P&L, fees, and funding at bid.
  Long floating equity marks BID; short floating equity marks ASK.
- **Funding is an assumed 5% annual debit** on absolute entry USD notional,
  accrued over actual calendar time/365 for both directions. It is not measured
  historical swap or carry. Cash interest is zero.
- Open positions at the final available 2025 bar close are forcibly closed with
  all costs and a distinct reason.

This is CFD cash/P&L accounting, not a currency deposit or physical FX total
return. Primary buy-and-hold fixes initial quantity with the same sizing and
costs, but carries exposure and funding throughout the decade.

The exposure diagnostic integrates the previous observed mark's absolute EUR
notional and notional/equity over elapsed intervals, including quote gaps. It is
a sampled approximation. A separately nested **ex-post exposure-scaled passive
comparison** multiplies the primary passive P&L and costs around EUR 10,000 by
`strategy average absolute EUR notional / primary passive average`. Cash earns
zero. This fractional synthetic allocation is not lot-deployable and is not a
third strategy case or an optimized strategy. Main charts retain the primary
benchmarks.

## Reproduce

Python 3.12 was used. Install `requirements.txt` in a suitable environment, then:

```sh
python download_data.py --symbols EURUSD GBPUSD --period M5 --start-year 2015 --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
```

Historical prices are Dukascopy-derived M5 aggregates distributed by
[EV Trading Labs](https://evtradelabs.com/data). Preserve its attribution.
Processed-file and annual-input checksums are in the manifests. Downloading
again requires current provider access and may fail if service policies change.
The public package excludes raw annual files and full M5 price files; the
scripts recreate them. Local workspace cache links are never evidence of a new
download. `data_quality.json` and gap audits report actual coverage and quote
absences without silently substituting another price source.

## Outputs and interpretation

`summary.json` and CSV contain net return, CAGR, net closed-trade profit factor,
calendar-daily Sharpe (sqrt365, risk-free zero), daily and sampled M5 drawdown,
recovery, win rate, costs, exposure, flat target dates and FTMO screens. Profits
and losses include every modeled fee and funding debit. A one-trade passive PF
is not statistically comparable to hundreds of trades.

Each local run writes complete trade logs, daily equity and compressed sampled M5
equity for all four series. The public download includes the two strategy M5
curves; full passive M5 curves are omitted for size and regenerated by
`backtest.py`. All four daily curves remain included.
Both `*_gap_events.csv` logs retain all 24-hour intervals, threshold decisions,
conversion ages and reasons. Exposure-scaled passive daily CSVs are explicitly
separate diagnostics. Four PNG charts show equity/drawdown, cumulative profit,
metrics and annual returns.

Daily aggregation attributes each M5 bar-end valuation to the interval just
completed (`bar_end - 1 nanosecond`). Thus a final bar ending exactly at the
exclusive 2026-01-01 boundary remains in 2025-12-31 daily equity. M5 equity still
keeps its actual ending timestamp.

The fixed 2016–2020 and 2021–2025 splits are retrospective stability diagnostics,
not pristine prospective out-of-sample evidence. Cross-boundary trades remain
in continuous equity; split trade metrics include only fully-contained trades.

## FTMO limitations

These are necessary-condition screens on each continuous EUR 10,000 account,
not completed challenge replays. They record first sampled loss breaches,
maximum flat balance, first flat EUR 11,000 attainment, a separate continuous
EUR 10,500 threshold and as-of-target 1-Step model consistency. The 2-Step
verification requires a fresh EUR 10,000 account; it is **not replayed** here.
An ending balance below target never proves that a prior target was absent.

The 1-Step consistency denominator is total **NET closed profit including
losing days**, not the sum of positive days. Model trade costs are allocated to
the exit day for this diagnostic. A continuous quoted Prague-midnight snapshot
precedes subsequent exit realization; across missing quotes, the first quote's
balance remains an approximation. Sampled M5 closes omit the tick equity path,
actual broker swap history and all other compliance details. A favorable screen
cannot certify a formal FTMO pass.

The source code and synthetic tests have not been executed inside MT5. See the
MQL5-specific notes accompanying the EA for execution differences and compilation
status. The original Python/MQL5 software is MIT licensed; source articles,
market data and dependencies retain their own terms.
