# Gold 30-minute opening-range breakout, with and without an RSI filter - frozen specification (RIP Backtest protocol v1.0)

Specification written **2026-10-07, before `gold_orb_protocol.js` was run on any data.** Bugs may be fixed after the run; rules may not.

## The claim being tested
A common retail setup, with no single source: take the high and low of the first 30 minutes of a trading session, trade a
breakout of that range, and (in the second version) only in the direction an RSI reading agrees with. We attribute the idea to nobody.
We test our own exact definition below.

## Instrument and data
- **XAUUSD spot gold from a broker (CFD-type price history), not futures.** MT4 `ICMarketsSC-Demo06\XAUUSD1.hst`, 1-minute bars
  from 2004 to 2026-10. Broker server time = New York time + 7 hours (server = UTC+2 in winter, UTC+3 during US daylight saving).
- Bars are timed by their open. Session times are defined in local exchange time and converted with the real daylight-saving rules
  (US, UK; Tokyo has none).

## Sessions (three, each tested on its own)
| Id | Open (local time) |
|---|---|
| AS | 09:00 Tokyo (= 00:00 UTC) |
| LD | 08:00 London |
| NY | 09:30 New York |
Monday to Friday only. One trade per session per day at most.

## Rules
- **Opening range:** the high and low of the 1-minute bars in the first 30 minutes from the open. The day is skipped if fewer than
  20 of those 30 minutes have data, or if the range is smaller than $0.60 (twice the round-trip cost: it cannot pay for itself).
- **Entry window:** from 30 minutes after the open until 4 hours after the open.
- **Entry:** stop-order breakout one tick ($0.01) beyond the range. Long on a break above the high, short on a break below the low.
  The fill is the trigger price, or the bar's open if the bar gaps through it. If both sides trigger inside the same 1-minute bar,
  the side nearer the bar's open is entered and the other side stops it out in the same bar (a full loss).
- **Stop:** the opposite side of the range, one tick beyond. No profit target.
- **Exit:** the stop, or the open of the first bar at or after 7 hours from the session open, whichever comes first.
- **Sizing:** 1 ounce. Results are reported in R (R = the range size) and net of costs.
- **RSI filter (variants B only):** RSI(14), Wilder, on 30-minute bars built from the 1-minute data. At the moment of a breakout the
  last completed 30-minute RSI is used. A long is allowed only if RSI > 50, a short only if RSI < 50. Each side's first breakout is
  evaluated once: if the RSI disagrees, that side is ignored for the rest of the day, and the other side stays available.

## Variants (declared up front; the ONLY ones tested)
AS, LD and NY, each without the RSI filter (A) and with it (B): **AS-A, AS-B, LD-A, LD-B, NY-A, NY-B**.
Variants tried: **6**. With six variants, one passing by luck is more likely, so the post states the count.

## Costs
**$0.30 per ounce per round trip**, as in our other gold tests. This is optimistic for the early years, when real retail spreads
on gold were wider. Gross figures are before cost.

## Periods
- Development (P1): 2004 to 2012. Validation (P2): 2013 to 2019. Holdout (P3): 2020 to 2026-10.
- The holdout is NOT unopened: the same gold history was used in earlier tests of other strategies. It is reported, flagged as used.
  No result of this strategy had been seen before this specification was written.

## Gates (protocol v1.0, net of costs, per variant; the statistic is net R per trade)
1. PF >= 1.2 in the validation period.
2. At least 50 trades in each period.
3. t-statistic >= 2.0 on the development period.
4. Above the 95th percentile of 500 random-entry runs.
5. Still positive after removing the 10 best trades.
6. Holdout net positive (flagged used).

## Random-entry control
Same sessions, entry windows, stop distance (one range, R, from the entry), 7-hour exit and costs, with **random entry minutes inside
the entry window and a random side**. On each eligible day a trade is taken with a probability calibrated so the trade count matches
the real variant. 500 runs, fixed seeds. The statistic is the average net R per trade over the full sample.

## Known limits (stated up front)
- Spot price history from one broker, not futures; real fills, spreads and slippage differ, especially in the early years.
- The RSI filter is one reasonable reading of the idea. We test it, not every way people use RSI with an opening range.
- Stops use 1-minute bars, so the order of events inside a minute is approximated.
