# Bull flag and bear flag breakout on NQ futures, 5-minute bars - specification (RIP Backtest protocol v1.0 plus the 8 Oct 2026 rules)

Specification written and **frozen 2026-11-14 (approved by the owner the same day: "Aprob, plus FLAG-MM"; draft 1 plus a fourth variant, FLAG-MM, the measured-move target that draft 1 had offered as an open choice)**, before any ATR, pole, flag, signal or trade of this test 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-14 from a suggestion written by another AI and pasted by the owner. The suggestion:
  - 5-minute bars;
  - a flagpole of at least 2 ATR;
  - a consolidation of 5 to 20 candles that gives back at most 50% of the pole;
  - long on a close above the flag's upper boundary, short on a close below the lower one;
  - stop beyond the flag's extreme;
  - exits at 1R, at 2R or with a trailing stop;
  - the flag's slope fixed mechanically, so a pattern is never found in hindsight.
  - Its title idea: "Bull Flag Trading Strategy Backtest: Does It Work?".
- **The suggestion's claims, checked on 2026-11-14:**
  - **"Not tested on the site": true.** No flag or pennant test is in the registry (87 published tests), in any `research/*_spec.md`, or in the September 2026 ES and NQ intraday work (`es_intraday.js`, the owner's NinjaTrader strategies). **Disclosed:** a private pattern-breakout indicator, PatternVolumeProfile, was tested without a protocol in September 2026 on gold (XAUUSD) 1-hour and 15-minute bars. It detects flags and pennants among nine patterns (with wedges, triangles and others). The recorded result is for all nine together: 1,020 trades at -0.03 R on 1-hour bars, -0.11 R on 15-minute bars, no edge. The script (`pvp_gold.js`) also prints a split by pattern, but that output was not saved, so no flag-only figure is on record; it is not rerun here. Different market, different rules, never published. No flag has been computed on NQ.
  - **Babypips: confirmed, with two differences.** The School of Pipsology lesson "How to Trade Flag Chart Patterns" (babypips.com/learn/forex/flags, read in the browser on 2026-11-14) gives the same checklist:
    - a sharp, almost straight-line flagpole;
    - two parallel lines that tilt against the pole or run sideways;
    - a pullback of at most about 50% of the pole;
    - entry on a close outside the flag, and the stop a little beyond the flag.
    - **The differences:** its "5 to 20 candles" is stated for a daily chart (one to four weeks), not for 5-minute bars. And its main target is the **pole's length projected from the breakout** (the measured move), with the flag's height as a closer target. The 1R, 2R and trailing exits come from the suggestion, not from Babypips.
    - The lesson gives **no test results**. It says flags form on any timeframe from 5-minute to weekly charts, and that shorter timeframes give more false breakouts. It also mentions volume confirmation for stocks and futures, which is not tested here (below).
  - **Academic work, not replicated here:** Cervelló-Royo, Guijarro and Michniuk (2015), "Stock market trading rule based on pattern recognition and technical analysis: Forecasting the DJIA index with intraday data", *Expert Systems with Applications* 42(14), 5963-5975. The authors used their own flag definition on 91,307 intraday observations of the Dow Jones index and tried 96 configurations of the rule. Arévalo et al. (2017) extended it. These are named in the article only as context; a rule chosen among 96 configurations says little about the next one.
- **Looked at before (disclosed):**
  - **The chart-pattern family, all Buried:**
    - head and shoulders, gold 15-minute (4 variants, best 5 of 6);
    - double top and bottom, gold 1-hour (4 + 4 variants, best 2 of 6);
    - engulfing candle, gold 1-hour (4 variants, all 2 of 6);
    - TheStrat on ES and on gold, 60-minute (4 + 4 variants, best 3 of 6);
    - inside bar breakout, EUR/USD daily (3 variants, best 2 of 6);
    - NR7 and NR4 breakouts, ES (3 variants, best 2 of 6);
    - trendline breakout and bounce, YM 1-hour (4 variants, best 3 of 6). This is the closest in mechanics: a close through a sloped line.
  - **On this NQ file:**
    - the **noise area breakout NQ** (New York session, long and long-short) is the site's only survivor, 6 of 6, with its forward test running; the other noise area NQ variants scored 1 to 3 of 6;
    - opening range breakout (best 3 of 6), initial balance breakout (best 4 of 6), first 5-minute candle with a fair value gap (2 of 6), MACD + RSI + 200 EMA on 5-minute bars (best 4 of 6), EMA 5/8/13 ribbon (best 4 of 6), 9 EMA (1 of 6), change of character (best 2 of 6), POC bounce (best 2 of 6), internal bar strength (daily, best 3 of 6);
    - the owner's unpublished SweepNQ indicator, on paper watch since 28 Oct 2026.
  - In the guides of 14 Nov 2026, breakout rules came closest to an edge and NQ was the best day-trading market.
- **Development bar t >= 2.5.** The chart-pattern family above has 34 variants on the site, far more than four, so the protocol's stricter bar applies.
- **Why it might not work (written before any result):**
  - On 5-minute bars, a move of 2 ATR within a few bars and a pause of 5 to 20 bars are common even in random prices, so many "flags" may be noise.
  - Babypips itself warns of more false breakouts on short timeframes.
  - A breakout entry pays slippage on a fast bar, and a 5-minute stop is small next to the $15.76 cost.

## Instrument and data
- **NQ** (E-mini Nasdaq-100 futures), `NQ_1min.csv`, the NinjaTrader export used by every NQ test: a back-adjusted continuous contract, 1-minute bars on the New York clock stamped at their close, all trading hours, with volume.
  - The file runs from 2020-01-01 18:01. It is **cut at 2026-09-25 17:00 New York** (`em_lib.CUT_MIN`), as in every published NQ test.
  - $20 a point, tick 0.25 point ($5).
- **Regular session:** 09:30 to 16:00 New York, the minutes stamped 09:31 to 16:00. Calendar: `rb_lib.js`, as in our other NQ tests.
  - Early closes at 13:15 (the day after Thanksgiving, 24 December, 3 July when not the holiday) are **short regular sessions**, used, ending at 13:15.
  - The 13:00 closes on US market holidays (the stock market is closed; the futures trade a short holiday session) are **not regular sessions**: no bar of theirs enters the chart and no trade is taken on them. This follows the Market Profile ES test; the POC NQ test kept them.
  - Days with no regular-hours minute are not sessions.
- **Periods (by entry date), as in all NQ tests:**
  - development: the file's second regular session (2020-01-03; the first one warms up the ATR) to 2023-12-31;
  - validation: 2024-01-01 to 2025-03-31;
  - holdout: 2025-04-01 to 2026-09-25, **already used** by earlier NQ tests (flagged).

## The chart
- **5-minute bars of the regular session**, on the clock: bar E holds the session minutes stamped E-4 to E (09:35 to 16:00: 78 bars on a full day, 45 on a 13:15 day). Bars are built from the minutes that exist; a 5-minute slot with no minute has no bar.
- The bars of consecutive regular sessions form **one chart** (an "RTH chart", as on a session-only futures chart). The overnight session is not on it.
- **ATR(14), Wilder's method**, on this chart:
  - true range = the bar's high and low, extended to the previous bar's close;
  - except the **first bar of each session**, whose true range is its own high minus low, so the overnight gap never enters the ATR;
  - seeded with the simple average of the first 14 true ranges in the file.
- **A whole pattern lies inside one session.** The pole's first bar is at or after the session's first bar; nothing from an earlier day is part of a pole or flag. Only the ATR runs across days.

## The pattern (fixed here; described for a bull flag, the bear flag is the mirror image)
Everything is evaluated **at the close of each 5-minute bar j** of the session, using bars up to and including j only.
1. **Pole top T:** the bar with the **highest high among the last 21 bars before j** in today's session (bars j-21 to j-1, or from the session's first bar). Ties go to the earliest such bar. The bars after T, from T+1 to j-1, are the **flag**. Their number n must be **5 to 20**.
2. **Pole start S:** the bar with the **lowest low among the 9 bars before T** (bars T-9 to T-1, not before the session's first bar). Ties go to the latest such bar. The pole is the bars S to T: **2 to 10 bars**.
   - The high of T must be higher than the high of every bar from S to T-1 (T is the top of the pole).
   - **Pole height** P = high of T minus low of S.
   - The pole must be **at least 2 x ATR(14)**, the ATR at the close of the bar before S. That bar may be the last bar of the previous session.
3. **Pullback at most 50%:** the lowest low of the flag bars (T+1 to j-1) is at or above high(T) - 0.5 x P. By point 1, no flag bar's high is above high(T).
4. **The channel, the mechanical slope:**
   - Number the flag bars x = 0 to n-1.
   - Fit a **least-squares line to their closes**: close ≈ a + b·x.
   - **Slope rule:** b <= 0 for a bull flag (down or sideways, as in the Babypips table); b >= 0 for a bear flag.
   - **Upper line** U(x) = a + b·x + the largest (high - (a + b·x)) over the flag bars. **Lower line** D(x) = a + b·x + the smallest (low - (a + b·x)).
   - The two lines are parallel, they share the fitted slope, and every flag bar lies between them.
5. **Breakout (the signal):** bar j **closes above U(n)**, the upper line extended to bar j (strictly above; tolerance 1e-9 point). For a bear flag: bar j closes below D(n).
6. **No hindsight:**
   - The channel at bar j is fitted on bars before j only.
   - Each bar refits the flag with the bars that exist at that moment.
   - A pattern, once signalled, is never redrawn.
7. **One signal per pole top:** a pole top T (per direction, per day) gives at most one signal: the first bar that closes beyond its channel.
   - A close beyond the **opposite** line (below D for a bull flag) ends that pattern without a trade.
   - So does a flag growing past 20 bars.
   - A signal that cannot be traded (below) or that comes while a position is open still uses up its pole top.
   - A bar with a bull and a bear signal at once gives no trade (both are used up).

**Not part of the rule:**
- **Volume** confirmation (Babypips mentions it for stocks and futures).
- Any **shape-quality** filter. The channel is parallel by construction, so a pause that a chartist would call a pennant or a wedge can pass as a flag if it meets the rules above. A shape threshold would be one more free parameter.
- **Pennants** as their own pattern.

## Trades
- **Signal window:** signal bars ending **10:10 to 15:30** New York; on a 13:15 day up to 12:45. The earliest possible pattern ends at 10:10 anyway: a 2-bar pole from 09:35, 5 flag bars, then the breakout bar.
- **Entry:** at the **open of the first minute after the signal bar**, inside the same session. No such minute: no trade.
- **Stop:** 1 tick (0.25) beyond the flag's extreme:
  - long: the lowest low of bars T+1 to j (the flag and the breakout bar) minus 0.25;
  - short: the highest high of bars T+1 to j plus 0.25.
  - **R** = the distance from the entry to the stop, in points. No trade if the entry is at or beyond the stop.
- **One position at a time** per variant; several trades a day are allowed. Long and short.
- **Exits, on 1-minute bars from the entry minute:**
  - a level that a minute opens beyond fills at that open;
  - if the stop and the target are touched in the same minute, the stop is taken;
  - otherwise **out at the session close**: the close of the last minute stamped at or before 16:00, or 13:15 on a short session. Every trade is closed the same session, so the test belongs in the day-trading guide.

## Variants (4: the three exits the owner picked, plus the measured move)
1. **FLAG-1R:** target 1R; otherwise the stop or the session close.
2. **FLAG-2R:** target 2R; otherwise the stop or the session close.
3. **FLAG-TR, trailing stop:** no target.
   - At the close of each 5-minute bar after the entry (the first one is the bar that holds the entry minute), the stop moves to the **highest high since the entry minus 2 x ATR(14) at the signal bar**, rounded down to the tick.
   - It only moves toward the price, never back; it starts at the flag stop; the new level applies from the next minute.
   - Short: the lowest low since the entry plus 2 x ATR, rounded up.
   - Otherwise out at the session close.
   - Two ATR is the pole's minimum size: a pullback as large as the smallest allowed pole ends the trade.
4. **FLAG-MM, the measured move:** target = the entry plus the pole height P for a long (the entry minus P for a short), the target Babypips teaches. Babypips projects it from the breakout point; here it is projected from the entry price. Otherwise the stop or the session close.

**Why only these:** the pattern rules (2 ATR, 5 to 20 bars, 50%, the slope rule) are the suggestion's and are not varied. ATR(14), the 10-bar pole limit, the close-price fit and the 1-tick stop buffer are the only readings added, each fixed once. Only the exit varies: the three the owner picked from the suggestion, and the textbook target the owner added at the freeze. Both directions are in every variant; longs and shorts are reported separately but not gated separately.

## Costs
- **$15.76 per round trip per contract**: commission $5.76 plus one tick of slippage ($5) on each fill, as in all NQ tests. A limit fill at a target may get no slippage in reality; the full cost is kept. Also shown at 1.5x and 2.5x (descriptive).
- Results in dollars per contract and in R.

## Expected number of trades (a guess from the rule, not computed)
Development has about 1,000 regular sessions, validation about 310, the holdout about 370. Breakouts of a 5-to-20-bar pause after a 2-ATR move should occur at least once on most sessions. **Expected: several hundred to a few thousand trades per variant in development, and well above 50 in every period.** The 50-trade gate should not bind. If it does, the protocol applies unchanged.

## Gates and control
- **Six gates per variant** (net dollars per contract):
  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 in all is Inconclusive.
- **Control (moved entries), as in the POC NQ and MACD + RSI NQ tests:**
  - every real trade keeps its entry time of day, its direction, its stop distance in points, its exit rule (the 1R, 2R or measured-move target distance in points; for FLAG-TR the trailing distance in points) and the session-close exit;
  - all trades move together to other regular sessions by one random circular offset of whole sessions, at least 5% of them;
  - on the new day each trade enters at the market, at the open of the first minute at or after the same time; a trade that would start after that session's close is dropped;
  - each moved trade is simulated on its own, with the same costs;
  - 500 runs, seeds 1000 + run. Statistic: the average net dollars per trade.
  - It asks whether the flag picks better moments than the same trades placed on other days.
- **Rule 3 (data holes):**
  - the suspect data: the NQ holes in `data_holes.json`, plus any run of 10 or more missing minutes inside regular hours and any session with unusually low regular-hours volume found by the data check;
  - a trade is flagged if suspect data lies between its pole's first bar and its exit, or it is taken on a suspect session;
  - flagged trades are reported, and every gate and verdict is recomputed without them; a changed verdict becomes Inconclusive.

## Also reported (descriptive; nothing here can change a rule or a verdict)
- **The funnel:** bars with a valid pole and flag; bull and bear signals; signals taken, skipped (position open), untradable; patterns ended by the opposite line or by the 20-bar limit.
- **The measured move, for every variant:** the share of trades whose price reached the pole height projected from the entry before the stop, and before the session close, with Wilson intervals. Also the same for the flag-height target (the channel's vertical width).
- Pole height in ATR and in points, flag length, pullback depth, slope, R in points, and the cost in R (medians).
- Win rate with its Wilson interval; exits by reason; best and worst move within each trade in R; trades per session; longs and shorts; by year; by entry hour; drawdown on closed trades.
- Results split by pole size, flag length and pullback depth (thirds). These are descriptive only: choosing a slice after the run would be a new test.

## Data check (automated, after the freeze, before any signal)
`flag_datacheck.js`, written to `flag_out/flag_datacheck.txt`:
1. First and last stamp and the cut; the file sorted with no duplicate stamp; every price on the 0.25 grid; high >= open, close >= low; no zero or negative price; minutes with zero volume counted.
2. Every New York weekday classed by the calendar: regular (16:00), short (13:15), market holiday with a 13:00 futures session, closed. Expected and found regular-hours minutes per session; sessions per year and per period.
3. Missing minutes inside regular hours: every run of 10 or more listed; sessions whose first minute is not 09:31 or whose last minute is not the close listed; compared with `data_holes.json` (NQ). 5-minute bars with fewer than 5 minutes counted.
4. **Mis-stamped days:** the ES file had the week of 2020-10-19 to 2020-10-22 shifted, with heavy trading at night. The same check is run on NQ: the share of each session's volume inside regular hours, with outliers listed.
5. Roll days (NQ rolls with ES, eight days before the third-Friday expiry in March, June, September and December): the session-open gap and the largest 1-minute move against other days; any 1-minute move above 1% listed. Sessions with regular-hours volume below 30% of the median of the previous 20 sessions are listed (for rule 3).

The check computes no ATR, pattern, signal or trade. Its result is reported with the run.

## Engine and self-test (before the run)
- An engine, `flag_lib.js`.
- A **separate re-implementation**, `flag_ref.js`, written from this specification without the engine's code: its own reader, bars, ATR, pattern search and walk. It is written by the same author (Claude), not by another agent, to save cost, as in the Market Profile ES test; that is stated. It reports trade counts only before the comparison.
- A self-test, `flag_selftest.js`:
  1. ATR by hand on built bars, including a session's first bar (no gap in the true range) and the warm-up.
  2. Hand-built sessions for the pattern:
     - a pole of exactly 2 ATR (taken) and 1 tick short (not);
     - a pole of 10 bars (taken) and 11 (not);
     - a flag of 4, 5, 20 and 21 bars;
     - a pullback of exactly 50% (taken) and 1 tick deeper (not);
     - slope 0 (taken), a rising bull flag (not);
     - a close exactly on U(n) (no signal) and 1 tick above (signal);
     - the tie rules for T and S;
     - a pole that would start before the session's first bar (not);
     - a flag bar printing a new high (T moves);
     - the opposite-line end of a pattern;
     - one signal per pole top;
     - a signal while a position is open;
     - a bull and a bear signal on one bar;
     - the 10:10 and 15:30 window edges and a 13:15 day;
     - a 13:00 holiday that is not on the chart.
  3. Hand-built trades:
     - the entry minute;
     - the stop (including the breakout bar's low);
     - an entry at the stop;
     - 1R and 2R targets;
     - stop and target in one minute;
     - a level gapped at a minute's open;
     - the trailing stop's update time, rounding and the rule that it never moves back;
     - the session close at 16:00 and 13:15.
  4. **No look-ahead (truncation test):** the data cut at 50 random minutes; every signal and entry before each cut must be identical to the full run's.
  5. Engine against reference, trade by trade, for the four variants on the real data.
  6. The control at offset 0 equal to the real trades.
  7. **Mutations** that must be detected (the engine changed, the reference not):
     - the ATR taken at the pole's end instead of before it;
     - a 60% pullback;
     - the slope rule removed;
     - the stop without its tick;
     - 4-bar flags allowed;
     - the trailing stop updated inside the bar.
- `flag_run.js` refuses to run unless this file is frozen (its sha256 matches the run log) and the self-test passed on the current code. One run; outputs in `flag_out/`.

## Before the article
- Results go to the owner first (in Romanian), with every variant and every gate.
- One article, only if the owner asks for it, and not before Monday 16 Nov 2026 (the pace is 3 to 4 posts a week). Deploys only with the owner's explicit agreement.
- Working title: "Bull Flag Trading Strategy Backtest: Does It Work?". The page must say that bear flags are in the same test.
- If it is published, the test joins the day-trading guide at the next weekly recompute. NQ only: ES or YM would be separate tests and separate posts, only if the owner picks them.

## Reading the result
"Buried" or "Inconclusive" mean a convincing edge was not demonstrated, not proof that none exists. The result covers one market, one session-only 5-minute chart, and one mechanical reading of a pattern that traders draw by eye. A different eye can draw other flags; that part cannot be tested by anyone, and the article will say so.

### Run log
- 2026-11-14: draft 1 written. Nothing computed on the rule or the data. The suggestion's claims were checked: no flag test on the site (the private gold pattern indicator of September 2026 is disclosed); the Babypips lesson read in the browser.
- 2026-11-14: frozen (owner: "Aprob, plus FLAG-MM"). The only change from draft 1: FLAG-MM added as variant 4 (the measured move, offered in draft 1 as an open choice); the other open choices of draft 1 stay as written (the 2 ATR trailing stop, a pole of at most 10 bars, the regular-session chart). sha256 of this file above the "### Run log" heading: a0fce69344235c45811a66fb8d23ee934cdf35dfba3b33b6517cbacad01744e3.
- 2026-11-14, the data check (`node flag_datacheck.js`, `flag_out/flag_datacheck.txt`), before any ATR, pattern or signal:
  - 2,373,779 minutes, 2020-01-01 18:01 to 2026-09-25 17:00 (file SHA-256 7980d835...); no backward or duplicate stamp, every price on the 0.25 grid, OHLC consistent, no zero volume.
  - Calendar: 1,677 regular and 12 short (13:15) sessions, 46 market holidays with a 13:00 futures session (not sessions here), 22 closed weekdays. rb_lib's calendar plus the data agrees with an independent NYSE list on every day except three normal trading days with no regular-hours minute in the file (2020-10-23, 2025-08-29, 2026-01-23, known holes). Regular sessions by period: 1,005 / 312 / 372.
  - 1,663 of 1,689 sessions have every regular-hours minute; ten runs of 10 or more missing minutes inside regular hours (four in March 2020, 2021-08-25, 2023-04-05 from 14:03, 2024-07-19, two on 2026-06-11, 2026-06-25); 46 of 131,301 five-minute bars have fewer than 5 minutes.
  - **Item 4: the same mis-stamped week as in the ES file**, 2020-10-19 to 2020-10-22: only 4.5-6.5% of each day's volume inside regular hours (median 76.7%), 82-86% between 22:00 and 06:00.
  - Roll days: no price jump at the 09:31 open. The roll days from March 2020 to September 2022 hold 4-11% of the previous session's regular-hours volume (the file takes the thin contract that day); 18 sessions are below 30% of the previous 20 sessions' median (those roll days, that week, 2022-11-25, 2025-11-28, 2026-06-12).
  - For rule 3 (saved in `flag_out/flag_datacheck.json`): the holes, the low-volume sessions and the mis-stamped sessions, as the spec says.
- 2026-11-14, before the run: `flag_lib.js` (engine), `flag_ref.js` (the separate re-implementation: its own reader, its own NYSE calendar lists instead of rb_lib, its own bars, ATR, pattern search with the bull and bear sides written out separately and a raw-sum regression, its own exits) and `flag_selftest.js` written. The reference reported its counts first: 455 signals; trades 449 (FLAG-1R), 443 (FLAG-2R), 441 (FLAG-TR), 440 (FLAG-MM).
  - The first self-test run failed 1 of 65 checks, on a hand-built day of the test itself: the 20-bar flat flag's first bar opened at 1005, which made its high 1005, so its upper line was 1005 and a close at 1005 was correctly no signal. The bar's open was set to 1004; no engine or reference code changed. The self-test then PASSED: 65 checks (35 hand-built pattern and trade checks; 50 truncation cuts with 9,952 signal comparisons, all identical; engine = reference trade by trade for the four variants; the control at offset 0; six mutations caught).
  - The bull-and-bear-on-one-bar rule was not hand-built (no day meeting both patterns' rules was constructed); it occurs 0 times in the data.
  - The self-test prints, at offset 0, the real trades' average, so these were seen before the run: -$23.42 (1R), -$22.76 (2R), -$54.20 (TR), -$52.15 (MM) a trade. No rule could change after the freeze; noted for completeness.
  - **The trade-count estimate of this spec was wrong:** 455 signals in all (0.27 a session), not several hundred to a few thousand per variant in development. The 50-trade gate may bind in validation; the protocol applies unchanged.
- 2026-11-14, the run (`node flag_run.js`, once, 500 control runs, outputs in `flag_out/`): **all four Buried, every one losing before costs.**
  - Funnel: 854 bull and 632 bear pole tops had a valid flag at some bar; 360 patterns ended by a close beyond the opposite line, 29 breakouts fell outside 10:10-15:30, none on both sides; 455 signals (277 bull, 178 bear), 0.27 a session. Median pole 112.5 points = 4.0 ATR over 9 bars, flag 6 bars, pullback 42%, median R 35.25 points (cost 0.027 R).
  - **FLAG-1R 1 of 6:** 449 trades (271 / 75 / 103), -$23.42 a trade net (gross -$7.66), PF 0.94; win rate 51.0%; DEV t -0.99, VAL PF 1.19, control 40.0th percentile, without the 10 best -$31,329, holdout -$4,408. Passes only the trade count.
  - **FLAG-2R 2 of 6:** 443 trades, -$22.76 (gross -$7.00), PF 0.95; passes the trade count and VAL PF 1.22 (75 trades, t 0.66); DEV t -0.70, control 40.6th, without the 10 best -$43,169, holdout -$7,107.
  - **FLAG-TR 1 of 6:** 441 trades, -$54.20 (gross -$38.44), PF 0.86; DEV +$9.90 a trade (t 0.18), VAL PF 0.63, control 17.6th, holdout -$14,116.
  - **FLAG-MM 1 of 6:** 440 trades, -$52.15 (gross -$36.39), PF 0.90; DEV t -0.32, VAL PF 1.16, control 21.6th, holdout -$23,491.
  - The measured move (entry + pole) was reached before the flag stop on 12.6-12.7% of trades (Wilson about 10-16%) and by the close on about 16%; the flag-height target before the stop on about 52%.
  - Rule 3 (6 trades flagged in each variant) changes no verdict. Nothing was rerun or changed.
  - Descriptive note: in the "thirds by flag length" line the first third is empty because at least a third of the trades have a 5-bar flag (the first cut equals the minimum); the split shown is 5-6 bars against 7-20 bars.
- 2026-11-14, the article: the owner asked for it ("Da, scrie-l"). `build_flag_post.js` builds it from the outputs of the single run, unchanged, and asserts every number and claim it prints; `wire_flag.js` wires it on the publication day (2026-11-16 or later, only with the owner's OK). A rerun from the post's own files (the data check, the self-test and the run, with NQ_1min.csv one folder above) reproduced every output byte for byte, apart from the dated first lines and the self-test's timing line. Added in the article only, computed from the trade logs (descriptive): in risk units the four versions were +0.008 to +0.043 R a trade before costs (t 0.11 to 0.75), because the wider-stop half of the trades did worse in R than the narrower half in every version.
- 2026-11-14: published as /posts/bull-flag-trading-strategy-nq/ on 14 Nov 2026 (the owner asked for the article on 2026-11-14: "Da, scrie-l"; and to publish it at once: "acum", although this specification had planned Monday 16 Nov 2026 at the earliest; deployed with the owner's explicit agreement).
