Rosetta stone · reconciles three classifiers + three meanings of "Off-Book" · 2026-05-12
You spotted the VWAP Pull-In · Off-Book dual label on the SOXL trade and called it a contradiction.
You were right. This page documents why three classifiers exist, what each one means, where the bugs are, and the canonical formula from the Trader Dale Pine reference.
regime_classifier.py has SLOPE_TREND_THRESHOLD = 3.0 with units "degrees" in the docstring, but the canonical Pine indicator computes slope in sigma/bar with a default threshold of 0.05. Same name, different math, different units. Every trade fails the threshold → 0 of 452 trades classified TREND in the 2026-04-21 audit. This is why trend-strategy live evaluation is blocked.
"Off-Book" means three different things depending on which file you're reading. The HUD label collision (VWAP Pull-In · Off-Book) on the SOXL trade was meaning #1 colliding with meaning #2 visually.
| # | Where | Term | Actually means |
|---|---|---|---|
| 1 | strategies-fuzzy.js:141 (HUD modal) |
Off-Book | Entered before 09:30 ET or after 16:00 ET. Off-hours. Has nothing to do with playbook match. |
| 2 | regime_classifier.py:276 (EOD scorecard) |
OFF_BOOK | No playbook strategy matched. Auto-F grade. This is the registry-aligned meaning. |
| 3 | scorecard_enrichments.py:414 (analytics) |
off-plan | Not on the morning Stocks-In-Play list. Stocks-In-Play discipline check. |
Fix: Rename HUD's Off-Book → Off-Hours in strategies-fuzzy.js. Eliminates the visual collision. (HUD-off-limits memory: requires Jim's explicit approval; flagged not patched.)
Path: Z:\gt_dev\live-accountability-v2\hud\js\strategies-fuzzy.js
Pure JS heuristic. Does NOT consume VWAP, bands, SD offset, or regime. Scores trades 0..1 on four signals:
After scoring, it joins the top-2 labels with · if both clear thresholds (best ≥ 0.28, second ≥ 0.24). That's where VWAP Pull-In · Off-Book comes from — both labels independently crossed their thresholds.
band-blind heuristic Violates the engine/UI separation rule. The fix is to swap this for an API call to classify_v2.py.
Path: Z:\setup_daily_reporting\reports\regime_classifier.py
Real band-aware classifier. Reads vwap, vwap_upper_1, band_slope, band_spread_rate from indicator_alerts. Used by gen_scorecard.py at EOD.
The regime detection logic (lines 47-117):
SLOPE_TREND_THRESHOLD = 3.0 # degrees <-- BROKEN UNIT SPREAD_RATE_TREND_MIN = 30.0 # % SPREAD_RATE_ROTATION_MAX = 15.0 # % # Both metrics available: is_trend = slope >= 3.0 OR rate >= 30.0 is_rotation = slope < 3.0 AND rate < 15.0
The docstring says "degrees" but the Pine canonical formula produces a sigma/bar ratio. If the TradingView webhook is sending sigma/bar, no trade will ever exceed 3.0. That matches the empirical "0 of 452 trades classified TREND."
unit mismatch Fix: change to Pine-aligned 0.05 sigma/bar (or whatever calibration shows), OR confirm webhook sends degrees and verify the 3.0 value.
Path: Z:\trading\indicators\src\indicators\TraderDale_VWAP.pine lines 110-118
Trader Dale's published rules say bands "flat" vs "fanning" determine ROTATION vs TREND. Pine implements this by measuring the slope of the +1σ band normalized to one sigma's worth of price:
// Slope of UB1 over lookback, normalized to sigma/bar
ub1_slope_raw = (ub1 - ub1[N]) / N // price change per bar
slope_per_sigma = abs(ub1_slope_raw) / sigma // sigma per bar (unitless ratio)
if slope_per_sigma > trend_slope_thresh // default 0.05
regime = ub1_slope_raw > 0 ? TREND_UP : TREND_DOWN
else
regime = ROTATION
So slope_per_sigma is a unitless number. A value of 0.05 means the band moves 5% of one sigma per bar. Over a 20-bar lookback, that's one full sigma of vertical band travel — the bar-by-bar threshold that distinguishes "bands fanning" from "bands flat."
Pine also returns a 3-state regime: ROTATION / TREND_UP / TREND_DOWN. The Python collapses TREND_UP and TREND_DOWN into single TREND.
canonical math Match this in Python and the TREND tag will start firing.
Path: Z:\setup_daily_reporting\reports\classify_v2.py
Schema-v2 classifier (not yet wired into gen_scorecard.py). Returns exactly ONE strategy_id from /system/strategies.json, or None for off-book. No dual labels possible. Uses band data + regime + extension proxies, NOT hold-time heuristics.
direction, entry_price, vwap, bands{lb3..ub5}, band_slope, regime, session_extension_{up,down}_sd, optional has_hh_hl_patternband-aware, schema-aligned Tested 12/12 against synthetic scenarios. Drop-in replacement for classify_entry() once wired.
trade_id 1574339 · SOXL short · entry 182.11 @ 08:30:36 ET · exit 177.80 @ 08:41:22 ET · +$8.62 · HUD says VWAP Pull-In · Off-Book, grade C.
| Classifier | What it sees | Verdict |
|---|---|---|
| strategies-fuzzy.js (HUD) | 11 min hold → pull-in match (sc=0.76). Entry < 09:30 ET → "Off-Book" off-hours (sc=0.60). Both above 0.28 threshold. | VWAP Pull-In · Off-Book (the dual-label bug) |
| regime_classifier.py (EOD) | Pre-RTH bar → band data likely missing or stale. band_slope probably tiny in sigma/bar units. With threshold 3.0 "degrees" → never TREND. Likely tags VWAP_PULL_IN or OFF_BOOK depending on sd_offset availability. |
probably mis-tagged (unit mismatch + pre-RTH data gap) |
| classify_v2.py (new) | SHORT, regime probably ROTATION (pre-RTH), entry near VWAP/+0.5 SD, no extension story. With v1.1 schema, a "regular_session_only" entry rule would mark this off-book cleanly. | vwap-pull-in-short OR off-book — never both |
The trade was a clean short fade from above VWAP back through bands. After classify_v2 wiring it would be tagged vwap-pull-in-short with quality grade reduced for pre-RTH entry — not the confusing dual label.
In order of cheapest → biggest unblock:
band_slope values from indicator_alerts for a week. Run regime_classifier_v2.calibrate_threshold(samples). If sample range is 0..0.5 it's sigma/bar (use ~0.05 threshold). If range is 0..90 it's degrees (current 3.0 may be too high; try 1.0).gen_scorecard.py. Drop-in; same signatures; defaults to Pine-aligned sigma/bar @ 0.05. Risk: changes tonight's scorecard tagging. Run a diff first.gen_scorecard.py classify_entry(). Now every trade gets ONE strategy_id keyed to /system/strategies.json. Dual labels disappear at the data layer.strategies-fuzzy.js. Eliminates the visual collision. (HUD-off-limits — requires Jim's by-name approval.)classify_v2.py endpoint. The HUD displays the canonical answer; no UI re-implements grading logic. This is the engine/UI separation rule landing.| File | Purpose |
|---|---|
Z:\setup_daily_reporting\reports\regime_classifier_v2.py |
Drop-in replacement with Pine-aligned sigma/bar formula. slope_units parameter supports both 'sigma_per_bar' (default) and 'degrees' for back-compat. |
regime_classifier_v2.calibrate_threshold(samples) |
Calibration helper. Feed real band_slope samples; returns p50/p75/p80/p90 + recommended threshold + unit inference. |
Z:\setup_daily_reporting\reports\classify_v2.py |
Schema-v2 classifier. 12/12 tests pass. Returns single strategy_id keyed to /system/strategies.json. |
/system/strategies.json |
Canonical registry. 9 strategies, full live-eval arrays. Schema_version 2. |
Generated 2026-05-12 · references memory file project_strategy_classifier_divergence.md · Pine source Z:\trading\indicators\src\indicators\TraderDale_VWAP.pine · back to strategy-system.html