{
  "version": "1.0",
  "strategy": "vwap_pull_in",
  "title": "Walk-Forward / Out-of-Sample Validation — VWAP Pull-In gate",
  "generated": "2026-06-09",
  "analysis_type": "read_only_no_db_writes_validation_addon",
  "core_question": "Frozen on a time split (train=earlier weeks, test=later weeks), does each rule keep the same sign out of sample? Does the gap -> instrument-type -> post-entry stack hold OOS before promotion?",

  "headline": "MIXED — DO NOT PROMOTE ON THIS OOS ALONE; FORWARD-TEST REQUIRED. The post-entry fade-exit and gap-RED / avoid-bad-type rules hold their sign out of sample. But 'megacap-tech = profitable' and the entry-gate-alone FLIP to mildly negative in the test half — they are relative (least-bad) filters, not absolute edges. The test window was a much worse regime, cells are tiny (full-clean test n=7), and one IBIT trade (-$216) is >half the test loss.",

  "data_basis": {
    "source": "Z:/trading/dev/vwap-band-entry-surface (Liberator backfill; trades_full.csv + MULTI_WINDOW_ENTRY_FEATURES.csv for post5/post15 state)",
    "no_db_query": true,
    "method": "time-ordered split of plain vwap-pull-in (no shuffle); rules are categorical (not parameter-fit), so the test = does each rule's sign/separation persist on unseen later data"
  },

  "split": {
    "n_total_plain_pi": 132,
    "split_date": "2026-05-14",
    "train": {"range": ["2026-04-10","2026-05-13"], "n": 77, "baseline_pnl": 91.08, "baseline_avg": 1.18, "baseline_win": 41.6},
    "test":  {"range": ["2026-05-14","2026-06-04"], "n": 55, "baseline_pnl": -389.21, "baseline_avg": -7.08, "baseline_win": 27.3},
    "regime_shift_warning": "The TEST period was a materially worse regime for plain pull-ins (baseline +$91 train vs -$389 test). OOS conclusions must be about SIGN/SEPARATION consistency, not absolute level — no static gate fixes a bad regime."
  },

  "rule_oos_results": {
    "fade5_exit": {"train": {"n":28,"avg":-2.33,"win":25.0}, "test": {"n":23,"avg":-19.54,"win":8.7}, "consistent": true, "verdict": "MOST ROBUST — fade loses in both halves, catastrophically in test (8.7% win). Cutting fades is the most reliable OOS rule."},
    "notfade5": {"train": {"n":49,"avg":3.19,"win":51.0}, "test": {"n":31,"avg":0.38,"win":38.7}, "consistent": true, "verdict": "positive/flat in both halves; the fade-exit cleanly separates OOS"},
    "gap_gt1.5_RED": {"train": {"n":31,"avg":-7.80,"win":25.8}, "test": {"n":23,"avg":-4.35,"win":21.7}, "consistent": true, "verdict": "negative both halves; robust by WIN RATE. Caveat: in test, gap<=1.5 avg (-9.03) looks worse than gap>1.5 (-4.35) because the IBIT -$216 outlier sits in the low-gap bucket — separation is outlier-contaminated on a PnL basis but holds on win rate."},
    "avoid_non_megacap": {"train": {"n":47,"avg":-2.56}, "test": {"n":34,"avg":-9.70,"win":17.6}, "consistent": true, "verdict": "non-megacap negative in both halves; avoiding it is robust"},
    "megacap_as_positive": {"train": {"n":30,"avg":7.05,"win":56.7}, "test": {"n":21,"avg":-2.83,"win":42.9}, "consistent": false, "verdict": "FLIPPED. Megacap was +$7.05 in train but -$2.83 in test. Still RELATIVELY best (test megacap -2.83 vs non-megacap -9.70), but NOT a reliable absolute edge — partly a favorable-regime artifact."},
    "entry_gate_alone(megacap & |gap|<=1.5)": {"train": {"n":21,"avg":12.23,"win":66.7}, "test": {"n":16,"avg":-2.95,"win":37.5}, "consistent": false, "verdict": "FLIPPED. The entry gate alone was strongly + in train (+$12.23) but mildly - in test. The entry gate by itself does not survive a regime shift."},
    "full_clean(entry_gate & not fade5)": {"train": {"n":15,"avg":13.57,"win":73.3}, "test": {"n":7,"avg":6.15,"win":57.1}, "consistent": true, "verdict": "POSITIVE in both halves — the post-entry fade-exit RESCUED the entry gate OOS (entry-gate-alone flipped negative; adding 'cut the fade' kept it positive). BUT test n=7 (very small). Encouraging, underpowered."},
    "early_exp5": {"train": {"n":5,"avg":10.99}, "test": {"n":5,"avg":0.81}, "consistent": true, "verdict": "positive both, tiny n"}
  },

  "outlier_sensitivity": {
    "worst_trade": {"symbol": "IBIT", "date": "2026-06-03", "pnl": -216.15, "half": "test"},
    "test_baseline_with_outlier": -389.21,
    "test_baseline_ex_outlier": -173.06,
    "note": "One IBIT trade is >55% of the entire test-half loss. The OOS verdict is dominated by (a) a regime shift and (b) this single outlier — both argue for forward-testing over trusting the historical split."
  },

  "what_held_oos": [
    "Cut the post-entry fade (fade negative in both halves; the single most robust rule)",
    "Keep not-fades (positive/flat both halves)",
    "Pass |gap|>1.5% (negative both halves by win rate)",
    "Avoid non-megacap types (negative both halves)",
    "The FULL combined stack (megacap + controlled gap + cut fade) stayed positive both halves — but test n=7"
  ],
  "what_did_NOT_hold_oos": [
    "'Megacap-tech is profitable' — flipped to -$2.83 in test (relative filter only, not absolute edge)",
    "Entry gate ALONE (before the fade-exit) — flipped to -$2.95 in test",
    "'Low gap = safe' — gap<=1.5 flipped negative in test (regime + outlier)"
  ],

  "validation_status": {
    "post_entry_fade_exit": "promoted_candidate (OOS-robust, strongest)",
    "gap_gt1.5_RED": "promoted_candidate (OOS-robust by win rate; watch outlier on PnL)",
    "avoid_non_megacap": "promoted_candidate (OOS-robust)",
    "megacap_as_absolute_edge": "working_rule_needs_backtest (flipped OOS; treat as relative/least-bad filter)",
    "entry_gate_alone": "working_rule_needs_backtest (flipped OOS; needs the post-entry overlay)",
    "full_combined_stack": "promoted_candidate_underpowered (positive both halves, test n=7)",
    "overall": "NOT READY for Strategy Library promotion on historical OOS alone. Regime- and outlier-sensitive at this sample size."
  },

  "recommendation": "HOLD promotion. The walk-forward did its job: it showed the durable core is the POST-ENTRY fade-exit + gap-RED + avoid-bad-type, and that 'megacap = money' was partly favorable-regime luck. Next step is a LIVE forward-test (the forward_test_live_log already exists), not another historical slice — the test half is too regime-/outlier-dominated to settle it. Promote nothing to production yet.",

  "sample_size_warnings": [
    "Test half n=55 plain-PI; full-clean stack test n=7; early_exp test n=5; entry-gate test n=16 — most OOS cells underpowered.",
    "One IBIT outlier (-$216) drives >half the test loss.",
    "Single time split (one train/test boundary), not k-fold/expanding-window CV — directional only.",
    "Regime shift between halves confounds absolute-level comparisons.",
    "In-sample-derived categorical rules tested on one OOS window of one trader's trades. Forward-test before trusting."
  ],

  "production_untouched": ["/strategies/", "/scorecards/", "gen_scorecard.py", "_scientific_overlay.js", "taxonomy", "DB", "no Stage B reclassification"]
}
