OPEN-SOURCE SCRIPT
H1 Z-score + DevVWAP (swing filters)

H1 Z-Score + DevVWAP (Swing Filters) — TradingView Indicator
Purpose
A lightweight filter to confirm or fade swing setups (1–5 days) using intermarket context. It measures how unusual the last 1-hour move is (Z-score) and how far price is from session VWAP (DevVWAP). Designed for risk-off proxies (DXY, ZN, VIX/VX) but works on any symbol.
What it shows
H1 Z-Score line
𝑍
=
1h return
𝜎
1h, rolling
Z=
σ
1h, rolling
1h return
using H1 data pulled via request.security.
Guide levels: ±1 (strong), ±1.5 (very strong), ±2 (extreme).
DevVWAP line (optional)
DevVWAP
=
Close
−
VWAP
VWAP
DevVWAP=
VWAP
Close−VWAP
from the current session.
Text panel / status (optional)
Human-readable hint: “PRO long equity”, “CONTRO long equity”, or “Mixed”, depending on Z and the asset’s role.
Inputs
Sessions lookback (default 20): how many sessions to estimate the 1h volatility baseline.
Hours per session (default 23): adjust for Globex vs cash hours.
Show DevVWAP (on/off).
Asset role = Risk-OFF? (true for DXY/ZN/VIX; false for equity indices/ETFs or risk-on FX/crypto).
How to read it (equity swing context)
For Risk-OFF assets (DXY, ZN, VIX/VX):
Z ≤ −1 (down move stronger than usual) and/or DevVWAP < 0 → PRO long equity (risk-on confirmation).
Z ≥ +1 and/or DevVWAP > 0 → CONTRO long equity (risk-off pressure).
For Risk-ON assets (set “Risk-OFF?” = false), invert the logic.
Typical use with a swing setup (Break & Retest):
If your setup is valid, add +10–15% confidence when ≥2 filters align (e.g., DXY Z ≤ −1 and below VWAP).
If signals are mixed, halve size (Reduce).
If ≥2 filters oppose, skip new entries (OFF).
Why it helps
Standardizes “strong vs normal”: Z-score compares the current 1h impulse to its own 20-session history.
Anchors to fair value: DevVWAP tells you if the filter asset is trading above/below its session value.
Portable: same logic across ES/FDAX/NQ/FESX (just apply the indicator to the filter symbols).
Practical tips
Symbols: prefer futures or liquid proxies (DX or 6E for DXY, ZN for UST 10y, VX for VIX future) so VWAP is meaningful.
Timeframe setting: the script fetches H1 internally; you can run it on any chart TF.
Labels vs timeframe: If you enable on-chart labels, do not pass a timeframe argument in indicator() (Pine forbids side effects with fixed TF).
Smoothing: keep 20 sessions; shorten only if regime shifts make the baseline stale.
Don’t trade it alone: it’s a filter for your swing setup (bias from D1/H4, trigger on H1/M15).
Typical workflow (1 minute)
Open a chart of the filter asset (e.g., DXY future).
Check Z relative to ±1/±1.5 and DevVWAP sign.
Repeat for ZN and VIX/VX.
If ≥2 agree with your trade direction → ON / size full; if mixed → Reduce; if opposed → OFF.
Limitations
Z-score assumes the recent 1h return distribution is a useful baseline; during extreme news this can break.
DevVWAP is session-dependent; ensure your session settings match the instrument’s trading hours.
No entry/exit rules by itself; it’s a context tool to modulate probability and size.
Purpose
A lightweight filter to confirm or fade swing setups (1–5 days) using intermarket context. It measures how unusual the last 1-hour move is (Z-score) and how far price is from session VWAP (DevVWAP). Designed for risk-off proxies (DXY, ZN, VIX/VX) but works on any symbol.
What it shows
H1 Z-Score line
𝑍
=
1h return
𝜎
1h, rolling
Z=
σ
1h, rolling
1h return
using H1 data pulled via request.security.
Guide levels: ±1 (strong), ±1.5 (very strong), ±2 (extreme).
DevVWAP line (optional)
DevVWAP
=
Close
−
VWAP
VWAP
DevVWAP=
VWAP
Close−VWAP
from the current session.
Text panel / status (optional)
Human-readable hint: “PRO long equity”, “CONTRO long equity”, or “Mixed”, depending on Z and the asset’s role.
Inputs
Sessions lookback (default 20): how many sessions to estimate the 1h volatility baseline.
Hours per session (default 23): adjust for Globex vs cash hours.
Show DevVWAP (on/off).
Asset role = Risk-OFF? (true for DXY/ZN/VIX; false for equity indices/ETFs or risk-on FX/crypto).
How to read it (equity swing context)
For Risk-OFF assets (DXY, ZN, VIX/VX):
Z ≤ −1 (down move stronger than usual) and/or DevVWAP < 0 → PRO long equity (risk-on confirmation).
Z ≥ +1 and/or DevVWAP > 0 → CONTRO long equity (risk-off pressure).
For Risk-ON assets (set “Risk-OFF?” = false), invert the logic.
Typical use with a swing setup (Break & Retest):
If your setup is valid, add +10–15% confidence when ≥2 filters align (e.g., DXY Z ≤ −1 and below VWAP).
If signals are mixed, halve size (Reduce).
If ≥2 filters oppose, skip new entries (OFF).
Why it helps
Standardizes “strong vs normal”: Z-score compares the current 1h impulse to its own 20-session history.
Anchors to fair value: DevVWAP tells you if the filter asset is trading above/below its session value.
Portable: same logic across ES/FDAX/NQ/FESX (just apply the indicator to the filter symbols).
Practical tips
Symbols: prefer futures or liquid proxies (DX or 6E for DXY, ZN for UST 10y, VX for VIX future) so VWAP is meaningful.
Timeframe setting: the script fetches H1 internally; you can run it on any chart TF.
Labels vs timeframe: If you enable on-chart labels, do not pass a timeframe argument in indicator() (Pine forbids side effects with fixed TF).
Smoothing: keep 20 sessions; shorten only if regime shifts make the baseline stale.
Don’t trade it alone: it’s a filter for your swing setup (bias from D1/H4, trigger on H1/M15).
Typical workflow (1 minute)
Open a chart of the filter asset (e.g., DXY future).
Check Z relative to ±1/±1.5 and DevVWAP sign.
Repeat for ZN and VIX/VX.
If ≥2 agree with your trade direction → ON / size full; if mixed → Reduce; if opposed → OFF.
Limitations
Z-score assumes the recent 1h return distribution is a useful baseline; during extreme news this can break.
DevVWAP is session-dependent; ensure your session settings match the instrument’s trading hours.
No entry/exit rules by itself; it’s a context tool to modulate probability and size.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.