# "Sneaky Pivot" on gold (XAUUSD), 15-minute bars from the COMEX open - specification (RIP Backtest protocol v1.0 plus the 8 Oct 2026 rules)

Specification written and **frozen 2026-10-23 (approved by the owner the same day, draft 1 unchanged)**. No gold level, bar, signal or trade of this test has been 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-10-23, after the YM test of the same rule ("hai pe aur sa facem"). **It is chosen after seeing a good result:** on YM three of four versions passed 5 of 6 gates, failing only the development t-statistic. That selection is stated wherever this test is reported, and it is why the strict t bar applies.
- **Why gold:** 22 years of data (about three times the YM sample), so the development gate can be passed if the edge is real; and a market that does not move with US stock indices, so a positive result would be new evidence. Our cross-market scoreboard (22 Oct 2026) found that a good result on one market predicted nothing on another, even with identical rules, so the prior expectation is low.
- **An adaptation, not an identical replication:** the YM rule starts at the 09:30 stock-index open. Gold trades almost around the clock, so the day and the opening candle are fixed below (the COMEX open, 08:20 New York, gold's most liquid open, also used by our gold night-vs-day test).
- **Looked at before (disclosed):** on this gold file, 14 published strategies in 97 versions (the gold guide), including the opening-range breakout from the London, Asian and New York opens, the noise area breakout, the H1 Open Trap and night vs day; none survived. **No rule built on the previous day's high and low has been tested on gold.**

## Instrument and data
- **XAUUSD**, IC Markets MT4 demo, 1-minute bid history 2004 to **2026-10-07 16:57 New York**, loaded with **`gx_lib.loadGold({ fix: true })`** (clock corrected, because the rule depends on the time of day); the whole run is repeated on the uncorrected clock and the difference reported. Minutes stamped at their close, New York clock.
- **The day = the broker day**, 17:00 to 17:00 New York (the server's midnight). A **usable day** has at least 600 minutes and its 08:21 bar. (The years 2004 to 2006 are thin, a median of 550 to 670 minutes a day, so many of their days are not usable; the count by year is reported.)
- **15-minute bars from the COMEX open:** bar 1 = minutes stamped 08:21 to 08:35, bar 2 = 08:36 to 08:50, bar 3 = 08:51 to 09:05, bar 4 = 09:06 to 09:20.
- **Holes (rule 3):** `data_holes_xau.json`; every gate and verdict is recomputed without the trades on a day touching a known hole.

## Rules (the YM rule, with the day and the opening fixed for gold)
- **Range high / low:** the previous usable day's high and low (at most 7 calendar days earlier; 20 usable days of history required). **Swing high / low:** as on YM, the high (low) of the most recent earlier usable day beyond the range, within 250 usable days (used in the descriptive statistics only).
- **Tolerance:** strict = 0; near = 10% of the average day range of the 20 usable days up to the previous day.
- **Setup:** long if bar 1's low is at or below range low + tolerance; short if bar 1's high is at or above range high - tolerance; both or neither: no trade.
- **Sneaky bar:** the first of bars 2 and 3 closing above its open (long) or below it (short). **Entry:** $0.01 beyond its high (long) or low (short), from the next minute to the end of bar 4 (09:20); a minute opening beyond fills at its open. **Stop:** $0.01 beyond the extreme of bar 1 to the sneaky bar; a minute reaching the stop before the entry cancels the setup.
- **Targets:** **T1** = bar 1's high (long) or low (short); **T2** = the range high (long) or range low (short). No trade if the entry is at or beyond the target.
- **Exits:** in the entry minute the stop only; then stop first, then target, on every minute; otherwise at the close of the last minute at or before **13:30 New York** (the COMEX close). One trade a day. No position is held overnight, so no swap.

## Variants (the only ones tested)
**SX-STRICT-T1, SX-STRICT-T2, SX-NEAR-T1, SX-NEAR-T2**, all long and short.

## Costs
- **$0.30 per ounce per round trip**, as in every gold test on the site; results in dollars per ounce and in R (entry to stop).

## Periods, gates, control
- **Periods (by trade date), as in every gold test:** development 2004 to 2012; validation 2013 to 2019; holdout 2020 to 2026-10-07 (**already used** by many gold tests).
- **Six gates per variant** (net dollars per ounce): validation profit factor >= 1.2; at least 50 trades in each period; development **t >= 2.5** (chosen after a good result elsewhere; many strategies tested on this file); 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 in all: Inconclusive.
- **Matched control (moved trades):** as on YM, every real trade moved, all together, by one random circular offset of whole usable days (at least 5% of them), entered at the open of the same minute of the new day, same direction, the same stop and target distances, the same 13:30 exit and costs. 500 runs, seeds 1000 + run.
- **Also reported:** how often bar 1 reaches each zone, the "phenomenon" check of the YM test (after bar 1, a break of the range low followed by the swing low the same day, and the same for highs), long and short, by year, exits by reason, usable days by year, and the run on the uncorrected clock.

## Engine and self-test (before the run)
New engine `snx_lib.js` (the YM engine's logic with the gold day, bars and costs), independent re-implementation `snx_ref.js`, `snx_selftest.js` that must pass before any result is printed: the broker-day levels on hand-made days, the 08:21 bar and the usable-day rule, both tolerances, setups both ways, the sneaky bar on bar 2 and bar 3, a cancelled setup, both targets, the 13:30 exit; the reference matched trade by trade on the real data for all four variants; the control machinery at offset 0.

## Before the article
Results go to the owner first. One article, linked to the YM article (with a correction note there), published only with the owner's agreement. Working title for search: "Previous Day High and Low Strategy on Gold (XAUUSD): Sneaky Pivot Backtest".

## Reading the result
"Buried" or "Inconclusive" mean a statistically convincing edge was not demonstrated; neither is proof that none exists. One market, one data source (a broker's spot gold), one adaptation of a rule demonstrated on Dow futures.
