# Classic pivot points on GBPUSD, 15-minute bars - specification (RIP Backtest protocol v1.0 plus the 8 Oct 2026 rules)

Specification written and **frozen 2026-11-07 (approved by the owner the same day, "Da, îngheață și rulează"; draft 1 unchanged)**, before any pivot level, signal or trade was computed. Once frozen, any change of a rule is documented and treated as a separate test; bugs may be fixed.

## Why this test, and what was looked at before
- **Chosen by the owner** on 2026-11-07 ("Pivot points") out of three famous strategies never tried on forex on the site. The owner asked for a world-famous strategy, on GBPUSD, 15-minute bars, with the entry and exit rules people look for.
- **Search demand** (Google autocomplete, 7 Nov 2026): "pivot point strategy" with "win rate", "day trading", "tradingview" and "pdf".
- **Rules as commonly published** (FxPro, EBC, Trading Strategy Guides, Arrow Algo and others, read 7 Nov 2026). The classic floor pivots are computed from the previous day's high, low and close, and are traded in three standard ways:
  - a **reversal** at S1 or R1 back to the pivot;
  - a **breakout** through R1 or S1 to R2 or S2;
  - a **London-open bias**: after the first 15 minutes of London, trade in the direction of price against the pivot, with the stop 5 to 10 pips beyond it, half the position out at S1 or R1 and the rest at S2 or R2.
  
  Where the sources differ (stops, targets, confirmation), one rule is fixed below and stated.
- **Earlier work on this file:** the London breakout (GBPUSD, published), the six-strategy FX study (60-minute, published) and the ADX study (published).
  - **Not published, without a protocol:** in October 2026 the owner's weekly Fibonacci pivots with the TDI were tried on gold and the four FX majors (1-minute, 25 variant-market pairs, none passed).
  - With those, the pivot family has more than four variants, so the development bar is **t >= 2.5**.
  - No classic daily pivot number has been computed on GBPUSD.

## Data
- **GBPUSD**, IC Markets MT4 demo, 1-minute bid history **2004-01-01 to 2026-09-28** (`fx_data.loadFx`), the file of the London breakout test.
  - New York wall clock; minute stamps are close times.
  - The clock was checked for that test: no shift. The file also passed the level and jump scan of 7 Nov 2026 (one jump, the Brexit vote of 24 June 2016, real).
- **London time** is computed from New York time with each country's own clock-change rules, so London hours are real all year.
- **The forex day** runs from 17:00 New York to 17:00 New York (the broker's midnight). Sunday evening belongs to Monday.
- **Holes (rule 3):** the suspect gaps of `data_holes_gbpusd.json` (London breakout audit).

## Pivot levels (classic floor pivots)
- From the **previous forex day**: H = its highest minute high, L = its lowest minute low, C = the close of its last minute.
  - P = (H + L + C) / 3;
  - R1 = 2P - L, S1 = 2P - H;
  - R2 = P + (H - L), S2 = P - (H - L).
- **No trade that day if** the previous forex day has fewer than 600 minutes (holidays and part days), or if today's day has no minute stamped 08:15 London.

## 15-minute bars
- On the clock: the bar ending at minute E (a multiple of 15 minutes) holds the minutes stamped E-14 to E.
- A signal uses the **close of a completed bar**. The trade is entered at the **open of the first minute after the bar**.
- Stops and targets are then checked on 1-minute bars:
  - a level the minute opens beyond fills at its open;
  - if the stop and a target are touched in one minute, the stop is taken.
- **Every trade is closed at the close of the last minute stamped at or before 16:59 New York**, before the daily rollover (no swap).

## Variants (all long and short, at most one trade a day each)
1. **PIV-REV (reversal at S1/R1, target P):**
   - **Signal:** the first bar ending between 08:15 and 16:00 London whose low is at or below S1 and whose close is above S1 (long), or whose high is at or above R1 and whose close is below R1 (short).
   - **Stop:** 1 pip beyond S2 (long) or R2 (short).
   - **Target:** P.
   - No trade if the entry is already at or beyond P, or at or beyond the stop.
2. **PIV-BRK (breakout of R1/S1, target R2/S2):**
   - **Signal:** the first bar in the same window whose close is above R1 (long) or below S1 (short).
   - **Stop:** P (the breakout has failed if price returns to the pivot).
   - **Target:** R2 (long) or S2 (short).
   - No trade if the entry is already at or beyond the target.
3. **PIV-LDN (London-open bias):**
   - **Signal:** the bar ending 08:15 London. Its close above P is a long, below P a short; equal is no trade.
   - **Stop:** 10 pips beyond P.
   - **Exit:** half the position at R1 (long) or S1 (short); the stop of the other half then moves to the entry; that half's target is R2 or S2.
   - No trade if the entry is already at or beyond the first target.
   - Results count the two halves as one trade.
- **R** is the distance from the entry to the stop, in pips. Results are in pips and in R.

## Costs
- **1.5 pips per round trip** (per whole position), as in the London breakout test.
- Scenarios, reported but not gated: 1.0 and 2.5 pips.
- No swap: every trade is closed before the daily rollover.

## Periods, gates, control
- **Periods (by entry date):**
  - development 2004 to 2012;
  - validation 2013 to 2019;
  - holdout 2020 to 2026-09-28, **already used** (the FX study and the London breakout).
- **Six gates per variant**, in pips per trade:
  1. validation profit factor >= 1.2;
  2. at least 50 trades in each period;
  3. development **t >= 2.5**;
  4. above the 95th percentile of the control;
  5. positive without the 10 best trades;
  6. holdout net positive (flagged as used).
  
  A variant with fewer than 30 trades is Inconclusive.
- **Control (moved entries):**
  - Every real trade is kept with its London entry time, direction and its stop and target distances in pips.
  - All trades are moved together by one random circular offset of whole trading days (at least 5% of them).
  - On the new day each trade is entered at the market at the same London time, with the same distances (for PIV-LDN both targets and the move of the stop), the same exits and costs.
  - 500 runs, seeds 1000 + run. Statistic: the average net pips per trade.
  - It asks whether the pivot levels pick better moments than the same trades placed on other days.
- **Missing data (rule 3):** trades open across a suspect gap are reported, and every gate and verdict is recomputed without them.
- **Also reported:**
  - how trades ended, and the win rate with its Wilson interval;
  - R and pips before and after costs;
  - longs and shorts, results by year;
  - the pivot range (H - L) by year;
  - the cost scenarios.

## Engine and self-test (before the run)
New code:
- `piv_lib.js`, the engine;
- `piv_ref.js`, an independent re-implementation (London time from the time-zone database, its own day and bar building, its own walk);
- `piv_selftest.js`. It checks:
  1. London time against the time-zone database across the clock changes;
  2. the forex day boundary and the pivot formulas by hand;
  3. hand-built days:
     - each variant's signal, entry, stop, target and the close before 17:00;
     - a gap through a level, and the stop and a target in one minute;
     - the London half-exit and the stop moved to the entry;
     - a day without the 08:15 bar, and a short previous day;
  4. engine against reference, trade by trade, for the three variants on the real data;
  5. the control at offset 0 entering on the real days, times and directions with the real distances.

## Before the article
Results go to the owner first. One article, published only with the owner's agreement.

## Reading the result
"Buried" or "Inconclusive" mean a convincing edge was not demonstrated; neither is proof that none exists. One pair, one broker's history, the classic pivots only (not Fibonacci, Camarilla or Woodie).

### Run log
- 2026-11-07: frozen. sha256 of this file above the "### Run log" heading: 795431673222c992a5d5fc05b586766d34d1e053c815a1401e9b93c38d5006d3.
- 2026-11-07, before the run: the first self-test run failed 6 checks, none about a result. (a) The London-time check included 02:00 New York on the Sundays the US clocks change, a time that does not exist (and is never traded); the check now uses trading times. (b) One hand-built PIV-LDN day had its plain minutes at the entry price, so the stop moved to the entry was touched at once; the case was rebuilt; and a label in the engine called a break-even exit at the open "stop" (the result was right). (c) Engine and reference differed on 5, 5 and 2 trades by one exit minute at the same price: the levels were computed by different but equal formulas (P - (H - L) and P - H + L) whose floating-point results differ in the last bit, and a level that is exactly a quoted price then compared differently. Fixed in both by rounding every level to 1e-8. The self-test then passed with 0 differences. No rule changed.
- 2026-11-07: the first launch of piv_run.js was stopped after about 15 minutes without a result line: the control recomputed London time minute by minute (hours per variant). London offsets and each day's exit minute are now cached (speed only); the self-test passed again with 0 differences and one control run took 0.23 s. piv_run.js -> piv_out/: all three variants Buried 1/6. PIV-REV 3,241 trades, avg -1.19 pips (gross +0.31), control percentile 66.4; PIV-BRK 3,442, avg -1.39 (gross +0.11), 65.0; PIV-LDN 4,937, avg -1.97 (gross -0.47), 9.8. Rule 3 changes no verdict. No rule was changed.
- 2026-11-07: the owner asked for the article ("Da, scrie-l"). Written from the outputs of the run, unchanged, to be published on 2026-11-11, after the two DAX posts and the Standard Error Bands post.
- 2026-11-11, data fix: the GBPUSD history file's time stamps are one hour early in most weeks of 2004-2014 (all of 2004, about half of 2005) and in a few weeks a year since, mostly between the US and European clock changes (the US 08:30 New York releases spike at the minute stamped 07:31), found by the pre-publication review of the pivot points test on 2026-11-11. The October clock audit (clock_audit_fix.json, 11 Oct 2026) had already moved 576 of 1,205 GBPUSD weeks by +60 minutes for its own reruns, but this test read the uncorrected file: it relied on the clock check of the London breakout test (the hour of the week open), which cannot see this shift. Rerun with a corrected copy (gbp_clockfix.js: the October decisions applied unchanged, every week of the file matched against the audit; prices untouched): the self-test passed and engine = reference on every trade. Rules unchanged; results replaced (the run on the uncorrected clock is kept in piv_out_v1_clock).
- 2026-11-11, on the clock fix: the October audit's decisions are applied unchanged; a later check found 7 weeks where its inherited move puts the 08:30 New York releases at 09:30 (2004-03-28, 2005-01-23, 2008-12-14, 2018-02-25, 2019-11-10, 2020-08-30 and 2020-09-06), holding 27 of the 4,883 trades of PIV-LDN; they are left as decided.
- 2026-11-11, Saturday stubs: moving the flagged weeks by +60 minutes turned the last hour of some Fridays (after 17:00 New York) into short "Saturday" forex days, and those stubs became the previous day of 221 Mondays, which were then skipped as following a short day. Fix in piv_lib.load and piv_ref.readGbp: minutes whose forex day is a Saturday are dropped (rules unchanged). Rerun: self-test PASSED (engine = re-implementation trade by trade); 5,871 traded days (4 after a short day, 29 without an 08:15 London minute); 11,807 trades; all three still Buried 1/6; PIV-BRK gross -0.20 pips a trade; control percentiles 81.6 / 49.6 / 11.0. The previous run is kept in piv_out_v2_satstub.
- 2026-11-11, jump scan: the 7 Nov scan named only the Brexit vote; a recheck of the largest 1-minute moves finds the flash crash of 7 October 2016 (19:08 on 6 October New York, 1,080 pips, real) as the largest, bad prints on 26 December 2016 (nine minutes, 04:02-04:53 New York, lows 1.1959-1.2111 against about 1.2275) and single wicks on 22 October 2015 04:31 (164 pips) and 26 October 2017 17:03 New York (104 pips). All left in the data, as the protocol does; one PIV-LDN trade used the pivots of 27 December 2016.
