OPEN-SOURCE SCRIPT
Weighted Sector ADD (sign-weighted)

What it is
A true, cap-weighted advances/declines (ADD) proxy for the S&P 500 using sector ETFs. Each sector contributes +1 if it’s up on the bar, −1 if it’s down, 0 if flat. Those signals are then weighted by your sector weights (auto-normalized to 100%) and summed into a single breadth line. The result is a fast, low-noise read of how much of the S&P (by sector weight) is advancing vs. declining right now.
- Tracks participation, not price magnitude—perfect for spotting “broad vs. narrow” moves
- Heavily weighted sectors (e.g., Tech) matter proportionally more, reflecting real index impact
- Simple scale: ~−1 to +1 (all weight down → all weight up)
Chart Elements
- Green/Red Columns – “Weighted ADD”: Current bar’s weighted breadth (sign-based by default)
- Blue Line – “Weighted MA”: SMA of the weighted ADD (regime filter)
- Zero/Guide Lines (optional): 0.0, ±0.2 (mild), ±0.6 (strong)
- Labels (optional): Text markers at those guide levels
- Advancing Weight % (optional): Label showing ((ADD+1)/2)*100 → share of total sector weight advancing
How to Read (Quick Guide)
- +0.60 to +1.00 → Broad, one-sided risk-on (most sector weight advancing)
- +0.20 to +0.60 → Moderate, supportive breadth
- −0.20 to +0.20 → Mixed/choppy; rotation
- −0.60 to −1.00 → Broad, one-sided risk-off
- MA above/below zero → Simple regime indicator; zero-crosses could be potential alert triggers
- Divergence: Strong price move with a weak/flat ADD could potentially warn of narrow participation
Inputs & settings
Calculation
- Use returns instead of up/down sign?
OFF (default): true weighted participation (+1/−1/0)
ON: weighted sector returns (winsor-capped). Use if you want magnitude, not just direction
- Winsor cap (returns mode): Caps per-sector contribution in returns mode (e.g., 0.02 = ±2%)
- Smoothing MA length: SMA period for the blue “Weighted MA” line
- Source timeframe: Compute signals on another TF (e.g., “60”) but plot on your chart TF
Visibility
- Show Weighted ADD (bars): Toggle the green/red columns
- Show Weighted ADD MA: Toggle the blue SMA line
- Show Zero Line (0): Toggle the 0.0 reference line
- Show ±0.2 / ±0.6 guide lines: Toggle the helper levels
- Show guide labels: Draw small text labels at 0, ±0.2, ±0.6
- Guide label offset (bars left): Move labels left if they overlap the right edge values
- Show Advancing Weight % label: Toggle the % of sector weight currently advancing
Sector Symbols (ETF proxies)
- XLK, XLY, XLF, XLV, XLC, XLI, XLP, XLE, XLB, XLU, XLRE: Defaults to the SPDR sector ETFs. You can swap for alternative proxies if desired.
Sector Weights (auto-normalize)
- Weight inputs for each sector (e.g., Tech 0.30, Financials 0.13…). These auto-normalize to 1.0 so you can paste rough numbers; the script scales them.
- Keep weights fresh. GICS sector weights drift; update periodically (e.g., quarterly).
Alerts included
- “Weighted ADD crossed above 0”
- “Weighted ADD crossed below 0”
Version
v1.0 – Initial release (weighted sign-based ADD + SMA, zero/guide lines & labels, Adv % label, alerts).
A true, cap-weighted advances/declines (ADD) proxy for the S&P 500 using sector ETFs. Each sector contributes +1 if it’s up on the bar, −1 if it’s down, 0 if flat. Those signals are then weighted by your sector weights (auto-normalized to 100%) and summed into a single breadth line. The result is a fast, low-noise read of how much of the S&P (by sector weight) is advancing vs. declining right now.
- Tracks participation, not price magnitude—perfect for spotting “broad vs. narrow” moves
- Heavily weighted sectors (e.g., Tech) matter proportionally more, reflecting real index impact
- Simple scale: ~−1 to +1 (all weight down → all weight up)
Chart Elements
- Green/Red Columns – “Weighted ADD”: Current bar’s weighted breadth (sign-based by default)
- Blue Line – “Weighted MA”: SMA of the weighted ADD (regime filter)
- Zero/Guide Lines (optional): 0.0, ±0.2 (mild), ±0.6 (strong)
- Labels (optional): Text markers at those guide levels
- Advancing Weight % (optional): Label showing ((ADD+1)/2)*100 → share of total sector weight advancing
How to Read (Quick Guide)
- +0.60 to +1.00 → Broad, one-sided risk-on (most sector weight advancing)
- +0.20 to +0.60 → Moderate, supportive breadth
- −0.20 to +0.20 → Mixed/choppy; rotation
- −0.60 to −1.00 → Broad, one-sided risk-off
- MA above/below zero → Simple regime indicator; zero-crosses could be potential alert triggers
- Divergence: Strong price move with a weak/flat ADD could potentially warn of narrow participation
Inputs & settings
Calculation
- Use returns instead of up/down sign?
OFF (default): true weighted participation (+1/−1/0)
ON: weighted sector returns (winsor-capped). Use if you want magnitude, not just direction
- Winsor cap (returns mode): Caps per-sector contribution in returns mode (e.g., 0.02 = ±2%)
- Smoothing MA length: SMA period for the blue “Weighted MA” line
- Source timeframe: Compute signals on another TF (e.g., “60”) but plot on your chart TF
Visibility
- Show Weighted ADD (bars): Toggle the green/red columns
- Show Weighted ADD MA: Toggle the blue SMA line
- Show Zero Line (0): Toggle the 0.0 reference line
- Show ±0.2 / ±0.6 guide lines: Toggle the helper levels
- Show guide labels: Draw small text labels at 0, ±0.2, ±0.6
- Guide label offset (bars left): Move labels left if they overlap the right edge values
- Show Advancing Weight % label: Toggle the % of sector weight currently advancing
Sector Symbols (ETF proxies)
- XLK, XLY, XLF, XLV, XLC, XLI, XLP, XLE, XLB, XLU, XLRE: Defaults to the SPDR sector ETFs. You can swap for alternative proxies if desired.
Sector Weights (auto-normalize)
- Weight inputs for each sector (e.g., Tech 0.30, Financials 0.13…). These auto-normalize to 1.0 so you can paste rough numbers; the script scales them.
- Keep weights fresh. GICS sector weights drift; update periodically (e.g., quarterly).
Alerts included
- “Weighted ADD crossed above 0”
- “Weighted ADD crossed below 0”
Version
v1.0 – Initial release (weighted sign-based ADD + SMA, zero/guide lines & labels, Adv % label, alerts).
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.