OPEN-SOURCE SCRIPT
Adaptive Regime Detector [4-State] [TSL]

════════════════════════════════════════════════════════════
RELEASE NOTES — paste into TradingView's "Publish update" box
Script: Adaptive Regime Detector [4-State] [TSL]
Version: v1.3 — Volume Z-Score & High-Conviction Alerts
════════════════════════════════════════════════════════════
v1.3 — Volume Z-Score & High-Conviction Alerts
Added a same-time-of-day volume z-score reading to the dashboard, plus a new alert that fires when unusual participation lines up with a favorable regime.
The regime engine tells you WHAT kind of market you're in. The anchored VWAP from v1.2 tells you WHERE fair value sits within it. Neither answers WHO is actually showing up at the current bar. A trending regime on thin volume is a different trade than the same regime on conviction flow — and the z-score is what makes that distinction visible at a glance.
Implementation matches the standalone Volume Z-Score Readout: the script tracks the volume seen at each bar's position within the session across the trailing 21 sessions, then computes z = (current volume − same-time-of-day mean) / same-time-of-day stdev. The 09:30 cash open is benchmarked against past 09:30 opens, the lunch lull against past lunch lulls. Volume that's "high" only counts as unusual for that specific moment.
New "Volume Z-Score" input group:
· Show volume z-score row (default on) — adds a row to the dashboard with the live signed z-score, color-coded by tier: gray for |z| under 1.0, blue for 1.0 to 2.0, orange for 2.0 to 3.0, red for 3.0 and above. Displays "—" until at least 5 sessions of data have accumulated at the current slot.
· Sessions for baseline (default 21) — number of past sessions used for the mean and stdev calculation. 21 ≈ one trading month.
· High-conviction z threshold (default 2.0) — z-score above which counts as unusual enough to alert.
· Alert on high-conviction setups (default on) — fires once when the z-score crosses above the threshold WHILE the regime is TREND or TREND+VOL. Uses the same transition-detection pattern as the regime-change alert, so you won't get spammed on every bar where the condition continues to hold.
The dashboard auto-resizes between 7 and 8 rows based on whether the z-score row is shown — toggle it off and the table is identical in layout to v1.2. Existing dashboard position and size preferences carry over unchanged.
No changes to the regime classification engine or the anchored VWAP. Percentile scoring, the confirmation buffer, VWAP anchor logic, and the existing regime-change alert all behave identically to v1.2. The z-score is additive — disable it and the indicator behaves exactly as it did before the update.
RELEASE NOTES — paste into TradingView's "Publish update" box
Script: Adaptive Regime Detector [4-State] [TSL]
Version: v1.3 — Volume Z-Score & High-Conviction Alerts
════════════════════════════════════════════════════════════
v1.3 — Volume Z-Score & High-Conviction Alerts
Added a same-time-of-day volume z-score reading to the dashboard, plus a new alert that fires when unusual participation lines up with a favorable regime.
The regime engine tells you WHAT kind of market you're in. The anchored VWAP from v1.2 tells you WHERE fair value sits within it. Neither answers WHO is actually showing up at the current bar. A trending regime on thin volume is a different trade than the same regime on conviction flow — and the z-score is what makes that distinction visible at a glance.
Implementation matches the standalone Volume Z-Score Readout: the script tracks the volume seen at each bar's position within the session across the trailing 21 sessions, then computes z = (current volume − same-time-of-day mean) / same-time-of-day stdev. The 09:30 cash open is benchmarked against past 09:30 opens, the lunch lull against past lunch lulls. Volume that's "high" only counts as unusual for that specific moment.
New "Volume Z-Score" input group:
· Show volume z-score row (default on) — adds a row to the dashboard with the live signed z-score, color-coded by tier: gray for |z| under 1.0, blue for 1.0 to 2.0, orange for 2.0 to 3.0, red for 3.0 and above. Displays "—" until at least 5 sessions of data have accumulated at the current slot.
· Sessions for baseline (default 21) — number of past sessions used for the mean and stdev calculation. 21 ≈ one trading month.
· High-conviction z threshold (default 2.0) — z-score above which counts as unusual enough to alert.
· Alert on high-conviction setups (default on) — fires once when the z-score crosses above the threshold WHILE the regime is TREND or TREND+VOL. Uses the same transition-detection pattern as the regime-change alert, so you won't get spammed on every bar where the condition continues to hold.
The dashboard auto-resizes between 7 and 8 rows based on whether the z-score row is shown — toggle it off and the table is identical in layout to v1.2. Existing dashboard position and size preferences carry over unchanged.
No changes to the regime classification engine or the anchored VWAP. Percentile scoring, the confirmation buffer, VWAP anchor logic, and the existing regime-change alert all behave identically to v1.2. The z-score is additive — disable it and the indicator behaves exactly as it did before the update.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน