OPEN-SOURCE SCRIPT
ETF vs Top 10 VWAP Deviation

This indicator plots two lines in a separate pane: the ETF's own % deviation
from its session VWAP, and the equal-weighted average VWAP deviation of its
top 10 holdings. The gap between them reveals intraday divergence — moments
when the ETF is leading or lagging the basket of stocks that drive it most.
Supports SPY and QQQ. Holdings are hardcoded as of March 2026 (updated
quarterly on rebalances). To avoid double-weighting Alphabet, GOOG is
replaced by LLY (SPY) and NFLX (QQQ) as the 10th component.
VWAP is calculated manually per symbol as cumulative(HLC3 × Volume) /
cumulative(Volume), resetting each session — matching standard session VWAP.
━━━ BASKET MODE ━━━
- % from VWAP — (price − VWAP) / VWAP × 100. Zero = price at VWAP.
Positive = above, negative = below. Directly comparable across symbols.
━━━ VISUALS ━━━
- Blue line = ETF | Orange line = Top 10 basket
- Graduated OB/OS bands at ±0.25, ±0.50, ±0.75, ±1.00
(yellow → orange → red, deepening with distance from zero)
━━━ USAGE NOTES ━━━
- Designed for intraday only. A runtime error is thrown
on weekly/monthly charts by design.
- Works best on SPY or QQQ charts directly. Running it on another symbol will
still calculate correctly but the ETF line will reflect that symbol's price.
- Holdings require manual updates on significant index rebalances (quarterly).
from its session VWAP, and the equal-weighted average VWAP deviation of its
top 10 holdings. The gap between them reveals intraday divergence — moments
when the ETF is leading or lagging the basket of stocks that drive it most.
Supports SPY and QQQ. Holdings are hardcoded as of March 2026 (updated
quarterly on rebalances). To avoid double-weighting Alphabet, GOOG is
replaced by LLY (SPY) and NFLX (QQQ) as the 10th component.
VWAP is calculated manually per symbol as cumulative(HLC3 × Volume) /
cumulative(Volume), resetting each session — matching standard session VWAP.
━━━ BASKET MODE ━━━
- % from VWAP — (price − VWAP) / VWAP × 100. Zero = price at VWAP.
Positive = above, negative = below. Directly comparable across symbols.
━━━ VISUALS ━━━
- Blue line = ETF | Orange line = Top 10 basket
- Graduated OB/OS bands at ±0.25, ±0.50, ±0.75, ±1.00
(yellow → orange → red, deepening with distance from zero)
━━━ USAGE NOTES ━━━
- Designed for intraday only. A runtime error is thrown
on weekly/monthly charts by design.
- Works best on SPY or QQQ charts directly. Running it on another symbol will
still calculate correctly but the ETF line will reflect that symbol's price.
- Holdings require manual updates on significant index rebalances (quarterly).
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.