{
    "meta": {
        "schema_version": "2.draft.v1.2",
        "status": "DRAFT — stress-test for v1.2 type additions (NOT promoted to /system/strategies.json)",
        "generated_at": "2026-05-16T00:00:00-04:00",
        "generated_by": "Manual draft, Draft 2.2 of UNIFIED-FRAMEWORK-v1.md",
        "purpose": "Stress-test the v1.2 evaluator-type additions (avwap_cross_from_swing, avwap_slope, stage_transition_signals, correction_type, trend_layer_depth, range_compression, most_recent_swing stop type) by authoring ONE representative new strategy (Markup Anticipation, long). If this composes cleanly under evaluate.py, promote the types to the canonical Type Catalog and add the strategy to /system/strategies.json.",
        "type_catalog_additions_v1_2": [
            "avwap_position",
            "avwap_slope",
            "avwap_reclaim",
            "avwap_cross_from_swing",
            "avwap_test_count",
            "avwap_pinch",
            "avwap_handoff_eligible",
            "stage_transition_signals",
            "correction_type",
            "trend_layer_depth",
            "range_compression",
            "mtf_trend_score_above",
            "vp_node_proximity",
            "breadth_above"
        ],
        "stop_variant_types_v1_2": [
            "most_recent_swing"
        ],
        "prerequisites": [
            "avwap_anchors.json registry — defines per-symbol anchors (ytd, qtd, mtd, last_earnings_gap, last_swing_high, last_swing_low, ipo, last_news_event)",
            "Regime classifier rebuild — must distinguish stage_1_to_2_transition from generic trend",
            "evaluate.py extended to dispatch the 14 new types"
        ],
        "shannon_citations": {
            "appx_a_four_stages": "Pages 169-173 — Stages 1-4 definitions; time vs price correction; innocent-until-proven-guilty framing",
            "ch_6_handoff_layering": "Pages 105-114 — new anchor in trend; layering as trend-maturity depth; remove anchors after no significant move",
            "ch_7_avwap_cross_purchase": "Page 121 — explicit named technique; 19% better entry than Breakout buy in his examples",
            "ch_7_buy_strength_after_dip": "Pages 115-119 — don't buy dip, buy strength after dip; most recent and relevant HL stop"
        }
    },
    "strategies": [
        {
            "id": "markup-anticipation-long",
            "name": "Markup Anticipation",
            "aka": "Stage 1→2 Transition Long / Shannon Markup Cross",
            "family": "vwap_pullback_continuation",
            "direction": "long",
            "short_mirror_id": "markup-anticipation-short",
            "long_mirror_id": null,
            "summary": "Anticipate the transition from Stage 1 Accumulation into Stage 2 Markup. Trigger fires when 4 of 5 Shannon confirming signals fire: (1) reclaim of a descending AVWAP, (2) AVWAP slope flat→positive, (3) price crosses AVWAP anchored at a qualifying prior swing high, (4) first Handoff fires (new HL above original anchor), (5) volume confirmation. Stop is structural — Shannon's 'most recent and relevant higher-low'. Edge: catching trend-leg-1 (highest R potential) vs leg-3 (short-leash continuation).",
            "strategy_version": "1.0.0-draft",
            "gating": {
                "regime_required": "stage_1_to_2_transition",
                "fallback_regime": "trend",
                "min_extension_sd": null,
                "bands_must_be_flat": false,
                "conditions": [
                    {
                        "type": "stage_transition_signals",
                        "from_stage": 1,
                        "to_stage": 2,
                        "min_signals": 4,
                        "required": true,
                        "_doc": "Hard gate — must have 4 of 5 confirming signals for entry"
                    },
                    {
                        "type": "trend_layer_depth",
                        "min_depth": 0,
                        "max_depth": 1,
                        "required": true,
                        "_doc": "Markup anticipation is leg-1 only — if we're already at Handoff #2, it's trend-trade-pullback, not markup-anticipation"
                    }
                ]
            },
            "entry_rules": [
                {
                    "id": "avwap_cross_prior_swing_high",
                    "label": "Price crosses back above the AVWAP anchored at a qualifying prior swing high",
                    "required": true
                },
                {
                    "id": "volume_above_average_at_cross",
                    "label": "Volume on the cross bar exceeds 20-bar average",
                    "required": true
                },
                {
                    "id": "avwap_slope_positive",
                    "label": "AVWAP from the prior swing high has slope flat or positive",
                    "required": true
                },
                {
                    "id": "no_overhead_resistance",
                    "label": "No major overhead resistance within 1× ATR (LVN above preferred)",
                    "required": false
                }
            ],
            "stop_variants": [
                {
                    "id": "most_recent_HL_loose",
                    "type": "most_recent_swing",
                    "side": "higher_low",
                    "lookback_bars": 30,
                    "min_relevance_bars": 5,
                    "label": "Below most recent and relevant HL (Shannon canonical, loose)",
                    "book_default": true,
                    "empirical_recommended": null
                },
                {
                    "id": "most_recent_HL_tight",
                    "type": "most_recent_swing",
                    "side": "higher_low",
                    "lookback_bars": 10,
                    "min_relevance_bars": 3,
                    "label": "Below most recent and relevant HL (tight — last 10 bars)",
                    "book_default": false,
                    "empirical_recommended": null
                },
                {
                    "id": "lb2_band_fallback",
                    "type": "sd_band",
                    "sd_offset": -1.0,
                    "label": "Fallback: -1 SD (LB2) if no qualifying swing exists yet (early Stage 2)",
                    "book_default": false,
                    "empirical_recommended": null
                }
            ],
            "target_variants": [
                {
                    "id": "next_handoff_or_resistance",
                    "type": "structural",
                    "label": "Next major resistance OR first Handoff opportunity, whichever first",
                    "book_default": true,
                    "empirical_recommended": null
                },
                {
                    "id": "trend_continuation_trail",
                    "type": "managed",
                    "label": "Trail behind most_recent_HL after Handoff fires; no fixed target",
                    "book_default": false,
                    "empirical_recommended": null
                }
            ],
            "rr_default": 3.0,
            "empirical": {
                "as_of": null,
                "sample_size": 0,
                "best_stop_id": null,
                "best_target_id": null,
                "expectancy_per_share": null,
                "win_rate_pct": null,
                "profit_factor": null,
                "notes": "Empirical fill TBD — strategy proposed 2026-05-16; live evaluation requires regime classifier rebuild (Stage 1→2 transition detection) and AVWAP anchor registry. Hypothesis: highest R potential of all VWAP/Pullback archetypes because it catches leg-1; expect avg MFE > 2.5R, WR ~50%, PF > 2.0."
            },
            "citations": [
                "Brian Shannon — Maximum Trading Gains with Anchored VWAP, Appx A (Four Stages); Ch.6 (Handoff/Layering); Ch.7 (Pullbacks/Breakouts, AVWAP Cross Purchase p121); Ch.8 (Multi-Day continuation)",
                "Stan Weinstein — Secrets for Profiting in Bull and Bear Markets (Stage 1-4 origin)",
                "UNIFIED-FRAMEWORK-v1.md Part 4.2.5 (Markup Anticipation framework)"
            ],
            "artifacts": {
                "classifier_function": "TBD — requires `is_stage_1_to_2_transition(symbol, asof)` in _scientific_overlay.js OR a Python equivalent",
                "param_surface_grid_id": null,
                "playbook_template_id": "playbook_template.html",
                "page_card_id": "markup-anticipation"
            },
            "auto_grade": null,
            "off_book": false,
            "_blocker_note": "Cannot live-grade until (a) regime classifier emits 'stage_1_to_2_transition', (b) avwap_anchors.json registry exists per-symbol, (c) evaluate.py dispatches the 7 new AVWAP types + 3 new gating types. P1 cluster.",
            "notes": "This is the ONE strategy authored in v1_2-draft to stress-test the new types. If the schema holds and evaluate.py can dispatch all 14 new types cleanly against this entry, promote the type catalog to v1.2 and author the remaining AVWAP archetypes (AVWAP-Cross-Purchase, AVWAP-Reclaim, AVWAP-Handoff, Multi-Day-AVWAP, Continuation-Gap).",
            "validation_rules": [
                {
                    "id": "stage_transition_still_active",
                    "label": "Stage 1→2 transition signals remain at ≥3 of 5 (downgrade threshold)",
                    "type": "stage_transition_signals",
                    "from_stage": 1,
                    "to_stage": 2,
                    "min_signals": 3,
                    "required": true,
                    "checked_on": ["bar_close"]
                },
                {
                    "id": "avwap_slope_still_positive",
                    "label": "AVWAP from prior swing high still sloping positive or flat",
                    "type": "avwap_slope",
                    "anchor_id": "prior_swing_high",
                    "direction": "positive_or_flat",
                    "min_abs_slope": 0.0,
                    "required": true,
                    "checked_on": ["bar_close"]
                },
                {
                    "id": "price_above_cross_avwap",
                    "label": "Price still above the AVWAP that was crossed at entry",
                    "type": "avwap_position",
                    "anchor_id": "prior_swing_high",
                    "side": "above",
                    "tolerance_sd": -0.2,
                    "required": true,
                    "checked_on": ["bar_close", "alert"]
                }
            ],
            "invalidation_conditions": [
                {
                    "id": "stop_breached",
                    "label": "Price closed below the chosen most_recent_HL stop",
                    "type": "stop_breach",
                    "action": "exit",
                    "severity": "hard"
                },
                {
                    "id": "avwap_lost_decisively",
                    "label": "Bar closed below the entry-AVWAP on 1.5× avg volume (definitive Stage-2 failure)",
                    "type": "compound",
                    "conditions": [
                        {"type": "avwap_position", "anchor_id": "prior_swing_high", "side": "below", "tolerance_sd": 0.0},
                        {"type": "volume_above", "lookback_bars": 20, "multiplier": 1.5}
                    ],
                    "action": "exit",
                    "severity": "hard"
                },
                {
                    "id": "stage_regression_to_1",
                    "label": "Transition signals dropped below 2 of 5 — Stage 2 thesis broken",
                    "type": "stage_transition_signals",
                    "from_stage": 1,
                    "to_stage": 2,
                    "min_signals": 2,
                    "negate": true,
                    "action": "exit",
                    "severity": "hard"
                },
                {
                    "id": "handoff_no_fire_in_window",
                    "label": "Time elapsed without a Handoff opportunity firing — momentum likely stalling",
                    "type": "compound",
                    "conditions": [
                        {"type": "time_elapsed", "minutes_since_entry": 60},
                        {"type": "avwap_handoff_eligible", "anchor_id": "prior_swing_high", "min_bars_since_anchor": 12, "min_R_from_anchor": 1.0, "negate": true}
                    ],
                    "action": "reduce",
                    "severity": "soft"
                }
            ],
            "management_rules": [
                {
                    "id": "move_stop_to_breakeven_at_1R",
                    "label": "Move stop to breakeven once trade is +1R MFE",
                    "trigger": {"type": "mfe_threshold", "min_r": 1.0},
                    "action": {"type": "move_stop_to_entry"}
                },
                {
                    "id": "scale_half_at_first_handoff",
                    "label": "Scale 50% when first Handoff opportunity fires (markup confirmed)",
                    "trigger": {"type": "avwap_handoff_eligible", "anchor_id": "prior_swing_high", "min_bars_since_anchor": 12, "min_R_from_anchor": 1.5},
                    "action": {"type": "scale_out", "fraction": 0.5}
                },
                {
                    "id": "trail_remainder_under_new_HL_after_handoff",
                    "label": "After Handoff, trail remaining stop below each new most_recent_HL (Shannon canonical)",
                    "trigger": {"type": "avwap_handoff_eligible", "anchor_id": "prior_swing_high", "min_bars_since_anchor": 12, "min_R_from_anchor": 1.5},
                    "action": {"type": "trail_stop", "trail_type": "most_recent_swing", "side": "higher_low", "lookback_bars": 20}
                }
            ],
            "quality_indicators": [
                {
                    "id": "all_5_signals_confirmed",
                    "label": "All 5 Stage 1→2 signals confirmed (not just minimum 4)",
                    "type": "stage_transition_signals",
                    "from_stage": 1,
                    "to_stage": 2,
                    "min_signals": 5,
                    "evaluated_at": "entry",
                    "weight": 0.20,
                    "direction": "positive",
                    "exclusive_with": []
                },
                {
                    "id": "time_correction_pattern",
                    "label": "Prior consolidation was a TIME correction (flat sideways) — stronger trend signal than price correction (Shannon Appx A)",
                    "type": "correction_type",
                    "expected": "time",
                    "lookback_bars": 20,
                    "range_threshold_pct": 0.02,
                    "evaluated_at": "entry",
                    "weight": 0.15,
                    "direction": "positive",
                    "exclusive_with": ["price_correction_pattern"]
                },
                {
                    "id": "price_correction_pattern",
                    "label": "Prior consolidation was a PRICE correction (deeper pullback) — still valid but lower conviction",
                    "type": "correction_type",
                    "expected": "price",
                    "lookback_bars": 20,
                    "range_threshold_pct": 0.05,
                    "evaluated_at": "entry",
                    "weight": 0.05,
                    "direction": "negative",
                    "exclusive_with": ["time_correction_pattern"]
                },
                {
                    "id": "tight_range_compression",
                    "label": "ATR percentile of last 10 bars in bottom quartile of 6-month distribution — high-quality breakout candidate (Shannon Ch.7)",
                    "type": "range_compression",
                    "lookback_bars": 10,
                    "atr_percentile_max": 25,
                    "evaluated_at": "entry",
                    "weight": 0.15,
                    "direction": "positive",
                    "exclusive_with": []
                },
                {
                    "id": "breakaway_gap_catalyst",
                    "label": "Entry within 5 bars of a breakaway gap (earnings, news, FDA, etc.) — institutional ignition (Shannon Ch.9)",
                    "type": "vp_node_proximity",
                    "node_type": "breakaway_gap",
                    "max_distance_sd": 1.0,
                    "evaluated_at": "entry",
                    "weight": 0.20,
                    "direction": "positive",
                    "exclusive_with": []
                },
                {
                    "id": "mtf_trend_alignment",
                    "label": "MTF Trend Matrix score ≥ 8 (of 12) on Confirmation tier — multiple timeframes agree",
                    "type": "mtf_trend_score_above",
                    "min_score": 8,
                    "tier": "confirmation",
                    "evaluated_at": "entry",
                    "weight": 0.15,
                    "direction": "positive",
                    "exclusive_with": []
                },
                {
                    "id": "exit_at_handoff_or_target",
                    "label": "Exit was via Handoff scale-out or target, not stop_breach (clean execution)",
                    "type": "exit_reason",
                    "expected": "scale_out_at_handoff",
                    "evaluated_at": "exit",
                    "weight": 0.10,
                    "direction": "positive",
                    "exclusive_with": []
                },
                {
                    "id": "stop_breached_at_entry_invalidation",
                    "label": "Exit was via stop_breach BEFORE the Handoff fired — Stage 2 thesis failed",
                    "type": "exit_reason",
                    "expected": "stop_breached",
                    "evaluated_at": "exit",
                    "weight": 0.15,
                    "direction": "negative",
                    "exclusive_with": []
                }
            ]
        }
    ],
    "stress_test_findings": {
        "purpose": "Issues discovered by authoring this single strategy against the proposed v1.2 type catalog. Each finding is a recommendation for the canonical promotion.",
        "findings": [
            {
                "id": "negate_field_for_invalidation",
                "issue": "stage_regression_to_1 needs to fire when signals DROP, not when they rise. Required a new boolean `negate: true` field on the type to express 'this condition is satisfied when the underlying check FAILS'. Currently only `compound` has this implicitly via boolean operators.",
                "recommendation": "Add `negate: bool` (default false) as a universal field on every type. Cheap, additive, generalizes."
            },
            {
                "id": "new_regime_value_stage_1_to_2_transition",
                "issue": "The regime classifier currently outputs `rotation | trend | unknown`. Markup-Anticipation needs a distinct `stage_1_to_2_transition` value because it's a different gating regime than mature trend.",
                "recommendation": "Add `stage_1_to_2_transition` and `stage_3_to_4_transition` to the regime enum. The classifier rebuild (P1) should emit these where signals warrant."
            },
            {
                "id": "trail_stop_with_type_param",
                "issue": "The existing `trail_stop` action takes `trail_band`. To trail behind `most_recent_swing`, need a polymorphic action: `trail_type` (band | most_recent_swing) + type-specific params.",
                "recommendation": "Extend ActionSpec with `trail_type` enum. Backwards-compatible — old configs with `trail_band` continue to work."
            },
            {
                "id": "anchor_id_resolution",
                "issue": "Validation rules reference `anchor_id: 'prior_swing_high'`. But which prior swing? Today's? Multi-day? The avwap_anchors.json registry must define a CANONICAL anchor per symbol per timeframe (e.g. `prior_swing_high_intraday`, `prior_swing_high_daily`).",
                "recommendation": "Anchor IDs in strategy schemas should be tagged with timeframe explicitly: `{anchor_type: 'prior_swing_high', timeframe: 'intraday'}`."
            },
            {
                "id": "fallback_regime_field",
                "issue": "Markup-Anticipation gates on `stage_1_to_2_transition` but should also accept `trend` (the existing regime) until the new classifier exists. Added `fallback_regime` to gating — needs to be canonical.",
                "recommendation": "Promote `gating.fallback_regime` to a canonical field. Lets new strategies degrade gracefully during classifier rollout."
            },
            {
                "id": "managed_target_variant",
                "issue": "target_variants[1] uses `type: 'managed'` with `label` describing trail behavior. This isn't a 'target' in the traditional sense — it's a no-fixed-target trail. Either rename to `exit_type: 'trail_only'` or add a distinct target type.",
                "recommendation": "Add `target_variant.type = 'trail_only'` as canonical. Distinct from 'sd_band' and 'structural'."
            },
            {
                "id": "vp_node_breakaway_gap",
                "issue": "The `vp_node_proximity` type was originally proposed for HVN/LVN. The breakaway_gap node_type is conceptually different (it's not a volume profile node — it's a gap location). Either generalize or split.",
                "recommendation": "Split: `vp_node_proximity` for HVN/LVN; new type `gap_proximity` for breakaway/continuation/exhaustion gap recency."
            }
        ]
    }
}
