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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.