# Noise Area Breakout on ES, NQ and XAUUSD, Asia, London and New York sessions - specification (RIP Backtest protocol v1.0 plus the 8 Oct 2026 rules)

Specification written and **frozen 2026-10-11 (approved by the owner the same day, draft 1 unchanged)**, before any noise-area band, signal or trade was computed for this test.

## The idea and why it was chosen
- Chosen by the owner on 2026-10-11: "Noise Area Breakout: enter when price leaves the bands computed from the historical moves at the same time of day; exit by the published rule", on ES, NQ and XAUUSD, on all three sessions. Three articles, one per market, each with its three sessions.
- The rule is that of Zarattini, Aziz and Barbon, "Beat the Market: An Effective Intraday Momentum Strategy for the S&P500 ETF (SPY)" (2024), tested there on SPY in the US session. We test the published entry and exit; we do not use its position sizing or leverage (one contract, or one ounce, per trade).
- Earlier tests on these files: many ES studies, EMA 9/21 (ES, NQ, GC), the NQ ribbon, intraday momentum (ES, NQ: the first half-hour did not predict the last), and on gold the opening-range breakout on the same three sessions, which was buried by costs. No noise-area number was looked at.

## Sessions (each tested on its own; local exchange time with the real daylight-saving rules)
| Session | Open | Close |
|---|---|---|
| AS (Asia) | 09:00 Tokyo (00:00 UTC) | 15:00 Tokyo (06:00 UTC) |
| LD (London) | 08:00 London | 16:30 London |
| NY (New York) | 09:30 New York | 16:00 New York, or the exchange's earlier close on early-close days (exchange calendar of `rb_lib.js`) |
Monday to Friday. A session is used only if its open bar and its close bar exist; otherwise it has no trade and is counted.

## Rules (the published rule, applied to each session)
- **Open** = the open of the first 1-minute bar of the session; **previous close** = the close of the same session on the previous trading day.
- **Move from the open:** for each minute m after the open, |close at m / open - 1|. **sigma(m)** = the average of that move at the same m over the **previous 14 sessions** that have a bar at m (at least 10 required, otherwise no signal at that m).
- **Noise area:** upper band = max(open, previous close) x (1 + sigma(m)); lower band = min(open, previous close) x (1 - sigma(m)).
- **Checkpoints:** every 30 minutes from 30 minutes after the open (for New York: 10:00, 10:30, ...), up to the last checkpoint at least 30 minutes before the close. Decisions use the close of the checkpoint minute; orders fill at the open of the next minute.
- **Entry:** flat and close above the upper band: buy; below the lower band: sell short (no shorts in the long-only variants).
- **Exit (trailing stop, checked at the checkpoints):** a long is closed when the close falls below max(upper band, VWAP); a short when it rises above min(lower band, VWAP). After an exit, the same checkpoint can open the opposite position if its condition holds (long and short variants). Every position is closed at the close of the session.
- **VWAP:** from the session open, with the bar volume: real contract volume for ES and NQ; tick volume for XAUUSD (a proxy; stated in the article). Typical price (high + low + close) / 3.
- **Variants:** per market and session, long and short (**LS**) and long only (**L**): 6 per market, **18 in total**, named NA-ES-NY-LS ... NA-XAU-AS-L.

## Data and costs
- **ES, NQ:** NinjaTrader back-adjusted 1-minute files (real volume), 2020-01-01 to 2026-09-25 17:00 New York. Back-adjustment adds constants at rolls; the bands are ratios to price, so older prices are distorted by a few percent of the band width (stated).
- **XAUUSD:** IC Markets MT4 1-minute bid history, 2004 to 2026-10-07 16:57 New York, **with the corrected clock** of the clock audit (`clock_audit_fix.js`; for weeks without a clear US data release the correction is an estimate, stated). The run is repeated on the uncorrected clock and the difference reported.
- **Costs per round trip:** ES $30.76, NQ $15.76 (commission plus one tick of slippage per fill), XAUUSD $0.30 per ounce, as in every test on these markets. A flip pays two round trips.
- **Holes (rule 3):** sessions with a known hole are reported, and every gate and verdict is recomputed without them.

## Periods, gates, control
- Periods by trade date: ES and NQ: development 2020-2023, validation 2024-01 to 2025-03, holdout 2025-04 to 2026-09; XAUUSD: development 2004-2012, validation 2013-2019, holdout 2020-2026. All **already used** by earlier tests.
- Six gates per variant (results in dollars per contract, or per ounce for gold): validation profit factor >= 1.2; at least 50 trades in each period; development **t >= 2.5** (18 variants are tried); above the 95th percentile of the control; positive without the 10 best trades; holdout net positive (flagged used). Fewer than 30 trades: Inconclusive.
- **Control:** each session-day's first entry (checkpoint and direction) is moved, with all days together, by one random circular offset of at least 5% of the sessions; on the new day the position opens at the same checkpoint in the same direction and is then managed by the same exit rule and costs. 500 runs, seeds 1000 + run. It asks whether the band breakout picks better days and times than the same entries placed on other days.

## Engine and self-test (before the run)
A new engine (`na_lib.js`). Self-test: hand-worked sessions (sigma from 14 sessions, both bands, a long, a short, the VWAP stop and the band stop, a flip, the session close, a missing bar, an early close, daylight-saving dates for the three sessions), the session times against the data, an independent re-implementation matched trade by trade for all 18 variants, and the control at offset 0 reproducing the real first entries. No result is printed.

## Before the articles
Results go to the owner first. Then three articles, one per market (ES, NQ, XAUUSD), each published only with the owner's agreement.

### Run log (2026-10-11)
The first run had a bug in the engine (`na_lib.js`): the session record stored the open price under the same name as the session open time, so the rule 3 check (does a session touch a known hole?) compared hole times with a price and marked almost every session. Trades, bands and gates were not affected (the bands used the price, as intended, and orders filled at the same bars; the independent re-implementation, which did not have the bug, matched trade by trade). The field was split into open time and open price, the self-test was run again, and every market was run again. No rule was changed.
