# TheStrat (Rob Smith) on gold (XAUUSD), 60-minute bars: the ES rules replicated - specification (RIP Backtest protocol v1.0 plus the 8 Oct 2026 rules)

Specification written and **frozen 2026-10-28 (approved by the owner the same day, draft 1 unchanged: "Da, îngheaț-o")**. Once frozen, any change of a rule is documented and treated as a separate test; bugs may be fixed. No bar, pattern, signal or trade of this test has been computed on gold.

## Why this test, and what was looked at before
- **Chosen by the owner** on 2026-10-28 ("sa incercam sa facem si pe gold testul?", then "1": the ES rules unchanged, including the New York entry window), **after** the TheStrat test on ES futures was run and published the same day (`strat_spec.md`, all four versions buried, best 3 of 6; the 2-2 reversal positive after costs and above its control but fragile). This is a **replication on another market with the rules frozen for ES**, chosen after seeing that result; disclosed here and in any article.
- **The method and the sources** are those of `strat_spec.md`: bar numbers 1, 2U, 2D, 3; the 2-1-2, 3-1-2 and 2-2 reversal; full timeframe continuity (FTFC); entry, stop and first target from secondary sources (LuxAlgo, the TradingView script "TheStrat Suite"), extended by us to the 3-1-2 and the 2-2.
- **Looked at before on this gold file (disclosed):** 15 strategies in 101 versions (the gold hub), among them the inside-bar-like H1 Open Trap and the engulfing candle on 1-hour bars (both buried, mainly by costs), the previous-day high-low reversal and Brad Goh's scalping model (buried); on other files, the inside bar on EUR/USD and NR7 on ES (buried). That raises the bar below.

## 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 60-minute bars and the day, week and month opens are cut on the clock); the whole run is repeated on the uncorrected clock and the difference reported. Minutes stamped at their close, New York clock. Prices in dollars per ounce; **1 tick = $0.01**.
- **Trading day:** from 18:00 New York the evening before to 17:00 (the broker day), labelled with the date it ends; week and month as in `strat_spec.md` (the first minute of the first trading day of the week or calendar month).
- **60-minute bars** on the clock hours (stamped at their close), built from the minutes that exist, overnight included; neighbours are the neighbouring existing bars.
- **Session:** gold spot has no exchange session; the ES window is kept on the New York clock: **fills stamped 09:31 to 15:00**, and a position still open at **16:00** closes at the close of the last minute stamped at or before 16:00. **A usable day** has at least 300 minutes stamped 09:31 to 16:00 (no early-close calendar for spot gold); fills only on usable days.
- **Holes (rule 3):** `data_holes_xau.json`; a trade is dropped if a known hole overlaps the span from the start of the bar before its trigger bar to its exit, and every gate and verdict is recomputed without those trades.

## Rules (unchanged from `strat_spec.md`)
- **Bar numbers:** 2U (high above the prior high, low not below the prior low), 2D, 3 (both), 1 (neither); equal highs and lows are not broken.
- **FTFC for a long:** the fill price strictly above the open of the current month, week, trading day and 60-minute bar; a short below all four; checked at the fill.
- **Orders:** a stop order one tick beyond the trigger bar, working only during the next 60-minute bar; a minute opening beyond it fills at its open. **STRAT-212** (a 1 after a 2U or 2D; both breaks; stop one tick beyond the 1's other side; target the 2 bar's extreme), **STRAT-312** (a 1 after a 3; target the 3 bar's extreme), **STRAT-22** (after a 2D, the break of its high; stop one tick below its low; target the high of the bar before it; the mirror after a 2U), **STRAT-212-NOFTFC** (STRAT-212 without FTFC).
- **Fills refused** (in this order) outside 09:31-15:00 or on a day that is not usable, if FTFC disagrees (not for NOFTFC), or if the target is not beyond the fill; the other order of the same trigger bar stays working; a minute reaching both orders: nothing from that bar.
- **Exits:** the stop from the fill minute, the target from the next minute (a level a minute opens beyond fills at the open; stop first), else the 16:00 close. One position at a time per variant; a trigger bar whose order window starts while a position is open is skipped.

## Variants (the only ones tested)
**STRAT-212, STRAT-312, STRAT-22, STRAT-212-NOFTFC.** All long and short.

## Costs
- **$0.30 per ounce per round trip**, as in every gold test on the site; also shown at 1.5x and 2.5x. Results in dollars per ounce and in R. Financing is not charged: positions never cross the 17:00 rollover.

## 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**; 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 entries):** 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 first minute of the new day at or after the same time, same direction, the same stop and target distances, the same 16:00 exit and costs. 500 runs, seeds 1000 + run. Statistic: average net dollars per ounce per trade.
- **Also reported (descriptive, no gates):** the bar numbers, the FTFC shares, the refused orders, the win rate with its Wilson interval, exits by reason, the median risk and target in dollars and in R, the cost in R, continuation against reversal, long and short, by year, by hour of entry, the run on the uncorrected clock, and **the comparison with ES** variant by variant.

## Engine and self-test (before the run)
`strat_gold_lib.js`, written from `strat_lib.js` (which stays unchanged, as published) with only the market changed: the gold loader, the tick of $0.01, the cost, the periods, the 16:00 session end and the usable-day rule without an exchange calendar. Independent re-implementation `strat_gold_ref.js` (from `strat_ref.js`, the same changes), `strat_gold_selftest.js` that must pass before any result is printed: the hand-made cases of the ES self-test rewritten in gold prices (each combo, FTFC refusing a fill and the other side filling, a gap fill, an order expiring, both orders in one minute, a target not beyond the fill, the 09:31-15:00 window, stop and target in one minute, the 16:00 close), a day under 300 minutes in the window (not usable), the trading day, week and month opens on the gold clock; the reference matched trade by trade on the real data for all four variants; the control at offset 0 entering at the real minutes.

## Before the article
Results go to the owner first: all four variants, every gate, long and short, by year, the exits, the cost in R, the comparison with ES. One article, published only with the owner's agreement, linked to the TheStrat ES post and the gold hub. Working title for search: "TheStrat Strategy on Gold: 2-1-2, 3-1-2 and 2-2 Reversals on 22 Years of XAUUSD".

## Reading the result
"Buried" or "Inconclusive" mean a statistically convincing edge was not demonstrated; neither is proof that none exists. One market, one broker's spot data, the New York window of the ES test kept on purpose, a method taught with more combos, timeframes and discretion, from secondary sources.
