# EURUSD daily IBS reversal — one long-only case

This is a transparent forex CFD adaptation of the [Quantified Strategies QQQ
IBS article](https://quantifiedstrategies.substack.com/p/the-ibs-indicator-the-powerful-indicator),
published 14 March 2026. It is not an ETF replication or evidence that the
source's equity results transfer to currencies. Both fixed five-year diagnostic
splits occur before that publication and are entirely retrospective.

One hypothetical EUR 10,000 account, EURUSD, is evaluated from 2016-01-01 through
2025-12-31 UTC. The two action rules belong to this **one case**; they are not
separate entry/exit strategies. A separate matched long buy-and-hold CFD is the
primary benchmark. No parameter or instrument variants were chosen by returns.

## Protocol frozen before results

`protocol.json` was frozen at `2026-11-25T09:07:58.419169+00:00`, before the first
historical IBS strategy run. Its SHA-256 is:

`9b7c971e7d843d9a04e806525dcda1ac153737453d98278bf5ca2d4195d5bb5b`

The engine checks `protocol.sha256` before execution. `run_environment.json`
records the actual run's start/completion, Python/package versions and code,
test and output checksums.

1. Aggregate actual M5 **BID** candles into observed UTC Monday–Friday daily
   OHLC. Exclude Sunday signal dates and create no missing-day bars. Observed
   partial weekdays remain included. IBS is `(close-low)/(high-low)`.
2. A completed day below IBS 0.10 enters long if flat; above 0.90 exits if long.
   Both comparisons are **strict**, so exact 0.10/0.90 does nothing. Zero-range
   days have no signal. For numerical stability the actual comparisons are
   `10*(C-L) < (H-L)-epsilon` and `10*(C-L) > 9*(H-L)+epsilon`, where epsilon is
   `1e-12*max(1,abs(H),abs(L),abs(C))`, far below one quote point.
3. Each observed weekday event becomes available at its following 00:00 UTC and
   is consumed once at the first observed M5 **OPEN** at or after availability.
   Friday events may execute at Sunday reopening. Pending events do not expire
   after 15 minutes. Current execution-bar high, low and close never select an
   order. Events retain chronological order across quote gaps.
4. Start 2016 flat. Only the latest observed 2015 weekday event can seed the
   initial decision, consumed once. Do not replay all 2015 events, search for
   the latest nonzero signal, or carry a 2015 position into the test. In this
   dataset the seed is 2015-12-31 and the first 2016 quote occurs Sunday 3 January.
5. Hold one long position. Repeated low signals add no position; high signals
   while flat do nothing. There is no stop, profit target, holding timer, trend
   filter or other condition. Remaining positions are forcibly closed at the
   last available 2025 close with costs and an explicit reason.

## EUR account, execution and funding

Opening buys use ask plus adverse 0.1 pip; sells use bid minus 0.1 pip. Historical
bid/ask spreads are retained. Commission is USD 3.50 per 100,000 EUR lot per
side. Minimum and step are 0.01 lot, floored down. The entry EUR notional cap is
1x current cash with entry commission reserved:

`lots = floor(cashEUR / (100000 * actualEntryPrice / EURUSDask + 3.5 / EURUSDbid) / .01) * .01`

Actual entry price already contains slippage. Positive USD P&L converts at
EURUSD ask; liabilities, commissions and funding use bid. Long floating P&L
marks instrument bid. EURUSD itself provides synchronized conversion quotes;
the code bounds entry quote age at 900 seconds and preserves/flags stale exit
conversion if a different input ever contains such an absence.

**Funding is an assumed 5% annual debit on absolute entry USD notional**, over
actual elapsed calendar seconds/365 for both ordinary holds and weekends. It
is not observed historical broker swap or carry. It starts at actual fill,
not at signal availability. Cash earns zero. This assumption can materially
affect long-duration results.

The account is CFD cash plus P&L, not a EUR currency deposit total return.
Buy-and-hold uses fixed initial base units and the same entry sizing/costs,
held from the first 2016 quote until the last available 2025 close. Its holding
duration and financing differ from the active strategy.

A separately nested **ex-post exposure-scaled passive diagnostic** uses
`strategy average absolute EUR notional / primary passive average` to scale
passive P&L and costs linearly around EUR 10,000. Cash earns zero. It is a
fractional synthetic allocation, not lot-deployable and not a second strategy
case. Main charts retain the primary passive comparison. Exposure averages use
previous observed marks carried over elapsed intervals, including gaps, rather
than future prices.

## Reproduction and data

Use Python 3.12 and the exact versions in `requirements.txt`. Recreate the
unbundled raw prices with the supplied downloader, verify the manifests, then:

```sh
python -m unittest test_backtest -v
python backtest.py --data-dir data --out results
```

The download and verification commands are documented in `data/README.md`.
Prices are Dukascopy-derived M5 bid/ask aggregates from
[EV Trading Labs](https://evtradelabs.com/data), not independently reconciled
bank tick exports or actual FTMO broker history. Input manifests preserve
annual and processed-file hashes. Raw annual files and full M5 price caches are
excluded from the public package; scripts recreate them subject to current
provider access. Existing local cache links are not new downloads.

`data_quality.json` records actual coverage, weekday partials and numerical
boundary counts. Missing raw prices are never imputed. The derived source
OHLC/IBS inputs and every event's source date, availability, execution time,
delay and reason are exported for audit.

## Results and audit files

`results/summary.json` and CSV contain net P&L, CAGR, closed-trade net profit
factor, calendar-daily Sharpe (sqrt365, risk-free zero), win rate, recovery,
costs, exposure and daily/M5 sampled drawdown. All closed-trade statistics include
commissions and funding. A single buy-and-hold trade does not provide a robust
profit-factor distribution.

`daily_bid_ibs.csv` contains all observed weekday daily inputs including 2015,
IBS, strict action and availability. `strategy_daily_events.csv` contains each
processed source event, including ignored and zero-range events. Complete trade
logs, all daily curves, the exposure-scaled diagnostic and four PNG charts are
included. Local runs write both compressed 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 aggregation attributes each M5 ending valuation to the interval just
completed (`bar_end - 1 nanosecond`). Consequently a final M5 bar ending exactly
at 2026-01-01 stays in 2025-12-31 daily equity. The M5 file keeps actual end times.
The fixed 2016–2020 and 2021–2025 splits are retrospective stability diagnostics;
trades crossing the split stay in continuous equity but are excluded from
split trade PF/win-rate calculations.

FTMO screens are necessary conditions on a single continuous account. They
record first sampled breaches, maximum flat balance, first flat 10% target and
as-of-target 1-Step best-day/total **NET** closed profit, including losing days.
The separate continuous 5% threshold is not a fresh verification phase. A
separate account reset, all phase conditions and tick equity are not replayed,
so no formal FTMO pass is certified. Where midnight quotes are continuous the
Prague balance snapshot precedes subsequent realization; missing-midnight gaps
still require a first-quote approximation. Modeled costs are allocated to the
exit day for consistency diagnostics. An ending loss alone never proves that
an earlier target was absent.

Synthetic tests cover strict thresholds, zero ranges, weekday/Sunday rules,
initial seeding, delayed weekend orders, repeated signals, causal entry,
EUR sizing/costs, funding start time, exposure, midnight/final-boundary handling
and prior target tracking. `INDEPENDENT_QA.md` records separate raw-data checks
when completed. MT5 compilation/execution status is stated only in the EA's
notes; Python execution is not evidence of MT5 compilation. Original software
is MIT licensed; articles, market data and third-party packages retain their
own terms.
