# Fibonacci 61.8% pullback on 1-hour EUR/USD bars - specification (RIP Backtest protocol v1.0 plus the 8 Oct 2026 rules)

Specification written and **frozen 2026-10-09 (approved by the owner the same night, draft 1 unchanged)**, before any swing, impulse, Fibonacci level, signal or trade was computed on EUR/USD for this test. Any later change of a rule is documented and treated as a separate test; bugs may be fixed.

## What was looked at before, and why this test was chosen
- The test was **chosen by the owner** on 2026-10-09: "Fibonacci 61.8% pullback, a retracement to 61.8% of a mechanically identified impulse", on EUR/USD. Timeframe (H1), directions (long only, and long and short) and exit (stop at the impulse start, target at the impulse end) chosen by the owner from proposals on the same day.
- Earlier tests on this same EUR/USD series: the FX study (six strategies on four pairs, 2004-2026), the 1-hour golden cross on EUR/USD (12 variants), and an unprotocolled test of weekly Fibonacci **pivots** with TDI (a different idea: pivot levels from the previous week's range, not retracements of an impulse). **No Fibonacci retracement rule has been tested on the site before.** No number of this test was looked at.

## What is tested
A **pullback to the 61.8% retracement** of a mechanically identified impulse, on **EUR/USD 1-hour bars**, entered with a limit order, with the stop at the start of the impulse and the target at its end. Two variants: **FB-L** (long only) and **FB-LS** (long and short). Other levels (38.2%, 50%, 78.6%), other exits, timeframes, pairs and filters are not tested here and will not be tried after seeing the result.

## Instrument and data
- EUR/USD spot, IC Markets MetaTrader 4 demo server, the terminal's 1-minute **bid** history (`EURUSD1.hst`), from the first bar of 2004 to the end of the file, **2026-09-28 15:47 New York** (the part of the file whose SHA-256 is in `mt4_prefix_hashes.json`; the loader cuts the file at that bar). Early years of a demo download may contain interpolated bars.
- **Time zone:** server time = New York + 7 hours, bar time = close time. On the gold file of the same server, 20 weeks followed European instead of US daylight saving and were corrected by moving their labels 60 minutes (`fixClock`). **Checked before the run from the EUR/USD data:** the weekly open and the daily break must sit at the same New York time on both sides of every US and European clock change; weeks that do not are listed and corrected the same way (labels only, prices untouched), or the run stops if the pattern is different.
- **Bars:** 1-hour bars closing on the hour New York time, built from the 1-minute bars with close times in (t - 60 min, t]. Incomplete bars are kept as they are (no filling, no synthetic prices). 24 hours a day, no session filter; positions and pending orders are held over weekends.

### Amendment before the run (2026-10-09, approved by the owner; no strategy number had been computed)
- **End of the data:** the last bar of the file closes at **2026-09-28 15:46** New York, not 15:47 as written above (the file is unchanged since 28 September; its SHA-256 matches `mt4_prefix_hashes.json`).
- **Clock check result:** the time check (`fb_timecheck.js`) found a pattern different from gold's, so the run was stopped as this specification requires. An external anchor (`fb_newsclock.js`: the price jump at the US data releases at 08:30 New York, such as the payrolls and the weekly jobless claims) shows the jump at 08:30 in 2015-2026 but at **07:30 in most weeks of 2005-2014**: in those years the labels of this file are about one hour early for most of the year, not only in the weeks where the US and European clocks differ. In 2015-2026 the jump is one hour early in many of the weeks where the US and European clocks differ. Gold shows the same problem in some years, not in the same weeks.
- **Treatment:** the data are used **as the loader reads them** (New York = server - 7 hours, no correction), because no week-by-week correction can be made reliably for every week. This rule uses whole 1-hour bars around the clock with no time-of-day condition, so a label error of a whole hour across a whole week leaves every bar, and so every trade, unchanged. **Check before the results are shown:** the run is repeated with the labels of every week of 2004-2014, and of every 2015-2026 week the 08:30 anchor calls early, moved by +60 minutes. It passes if every trade has the same entry and exit prices and the same R (time stamps may differ by exactly 60 minutes); trades that move across a period boundary are reported. If it fails, the run stops again and the owner is told.
- The finding is reported in the article's data notes. Studies already published on these MT4 files whose rules depend on the time of day (the gold opening-range breakout, and any session rule of the FX study) are to be audited separately afterwards (owner's decision of 2026-10-09).

## Data audit (before the run)
Gaps inside days were never audited for this file. Before anything is run, every gap between consecutive 1-minute bars longer than 30 minutes is listed and classed as **normal close** (the weekend, and broker holidays with usual start and end times), **suspect** (a gap inside the trading week, a late open or early end at an unusual time, a weekday with no or almost no bars) or **unclear**. The list is published (`data_holes_eur.json`) with the share of minutes present per year. **Treatment:** prices are never filled; a pending order or open position stays across a gap and is checked from the first bar after it (a level gapped through fills at that bar's open). **Rule 3:** trades whose pending period or holding period touches a suspect or unclear gap are counted, and every gate and verdict is recomputed without them (gate 4 from the run); a changed verdict becomes Inconclusive.

## Rules
All decisions are taken at the close of a 1-hour bar, on completed bars only; orders act from the next 1-minute bar.
- **ATR(14):** Wilder's average true range of the 1-hour bars, seeded with the simple average of the first 14 true ranges.
- **Swings (Williams fractals, 2 bars each side):** bar k is a **swing low** if its low is strictly lower than the lows of the two bars before and the two bars after it; a **swing high** mirrors this with highs. A swing at bar k is **confirmed at the close of bar k + 2** and is not known before then. Ties (equal lows or highs) do not make a swing.
- **Long impulse:** measured from **L**, the low of the most recently confirmed swing low, to **H**, the highest high of the bars after that swing bar up to the last completed bar. The impulse **qualifies** when H - L >= **3 x ATR(14)** (the ATR at the last completed bar). A newly confirmed swing low replaces L and starts a new impulse (the old one, if still pending, is cancelled).
- **Entry:** while a qualifying impulse has no fill, a **buy limit** order sits at **E = H - 0.618 x (H - L)**. At each bar close H, E and the target are recalculated from the completed bars (H can only rise); inside a bar the levels set at the last close apply. The order is filled in the first 1-minute bar whose low is at or below E, at **E, or at the bar's open if it opens below E** (gapped through). If that fill price would be at or below L, the order is cancelled instead (the impulse is broken).
- **Cancel without a trade:** a new swing low is confirmed (new impulse), or price trades at or below L before the order is filled, or the variant already has an open position (see below).
- **Exit:** **stop at L**, **target at H** (the values at the fill; they do not move after it). R = fill price - L. The stop can be hit in the entry minute; the target is not checked in the entry minute. If the stop and the target are both touched in the same minute, **the stop is taken**. A level gapped through fills at the open of that minute. No time exit. A position open on the last bar is closed at its close and flagged.
- **Short:** the mirror image: impulse from the most recent confirmed swing high down to the lowest low since, sell limit at E = L + 0.618 x (H - L), stop at the swing high, target at the low.
- **One impulse, at most one trade.** **One position at a time:** while a position is open no order is placed and pending orders are cancelled; after the exit, an impulse that has not traded and still qualifies can place its order again from the next bar close.
- **FB-LS only:** if a long and a short order are both touched in the same minute, neither is filled and both are cancelled (counted and reported).
- **Variants (the only ones tested):** **FB-L** (long impulses only) and **FB-LS** (long and short impulses). Two variants.

## Costs (the FX study's model, unchanged)
About **1.0 pip per round trip**: 0.15 pip adverse on every fill (a 0.3 pip spread assumed, the data being bid prices) plus 0.7 pip commission per round trip (IC Markets Raw Spread, USD 3.50 per lot per side). Kept so the results are comparable with the other EUR/USD tests. Constant across years, which flatters 2004-2012. **Carry (the overnight swap) is not modelled**; the average number of nights held is reported so its possible size can be judged. Results in **net R per trade**, pips shown next to them.

## Periods and data use
- **Periods (by fill date):** development 2004 .. 2012; validation 2013 .. 2019; holdout 2020 .. 2026-09-28 15:47.
- **None of these periods is fresh:** all three were used by the earlier EUR/USD tests listed above, so the holdout is reported as "already used".

## Gates and verdicts
Six gates per variant: validation profit factor >= 1.2; at least 50 trades in each period; development t >= **2.0** (two variants are tried, so the 2.5 bar for more than four variants does not apply); above the 95th percentile of 500 runs of the matched control; positive without the 10 best trades; holdout net positive (flagged used). Fewer than 30 trades: Inconclusive; otherwise Buried or Survivor.

## Matched control
A **time-shifted setup control**: every real qualifying impulse is kept with its direction, its size H - L and the number of bars its order stayed pending, and its start is moved by one common random offset of at least 5% of the length of the bar series (circularly). At the shifted bar the same-shaped order is rebuilt on the real prices: for a long, H' = the high of the shifted bar, L' = H' - (H - L), E' = H' - 0.618 x (H - L), the order pending for the same number of bars or until price trades at or below L', then the same fill, stop, target, cost and one-position rules. It asks whether the swing and impulse context adds anything over placing the same Fibonacci-shaped orders at other times. 500 runs, seeds 1000 + run, the same offsets for both variants. Statistic: average net R per trade.

## Engine and self-test (before the run)
A new engine (`fb_lib.js`) with a self-test that must pass before any result is printed:
1. Hand-worked cases: fractal swings with ties and confirmation two bars later; an impulse that qualifies, extends (H, E and target recalculated) and is cancelled by a new swing low; a fill at E and a fill at a gapped-below open; a fill price at or below L cancelled; stop in the entry minute; stop and target in the same minute (stop taken); a level gapped through; an order and a position across a weekend gap; the long-and-short collision in one minute; costs in pips.
2. The 1-hour bars and ATR checked against a naive recomputation on the real data.
3. An **independent re-implementation** of swings, impulses and trades, matched trade by trade for both variants on the real data.
4. The control with offset 0 reproduces the real trades.

**Self-test note (2026-10-09, while writing the self-test, before any result; no rule changed):** item 4 cannot hold as written, because the control rebuilds fixed levels from the shifted bar's high or low while the real rule recalculates its levels as the impulse extends, so even at offset 0 the two differ. The check was split: (a) the control's machinery (moving the setups, their lifetimes, the one-position rule) fed with the **real orders bar by bar** at offset 0 must reproduce the real trades exactly, and it does for both variants; (b) the control as specified above runs at offset 0. The control used for gate 4 is the one specified above, unchanged.

## Before the article
The results go to the owner first: both variants, every gate, drawdown on closed trades and including open positions, the hole sensitivity, long and short separately. The article (one test, one market) is built only after that, and published only with the owner's agreement.

## Always reported
Win rate with its 95% Wilson interval, how trades ended (target, stop, end of data), how many impulses qualified and how many of them were filled, average hours and nights held, gross and cost per trade in R and pips, long and short separately, drawdown on closed trades and including open losses, buy and hold over the same period for reference, and the sign of every result.

## Reading the result
"Buried" or "Inconclusive" mean a statistically convincing edge was not demonstrated; neither is proof that none exists. One pair, one broker's demo history, one level, one swing definition, one impulse size.
