OPEN-SOURCE SCRIPT
SPX Sector AD + Iceberg TICK

This indicator is a "Market Internals" engine designed to reveal the true strength of S&P 500 moves. By looking under the hood of the index, it helps traders distinguish between broad market participation and rallies driven solely by heavyweights (the "Magnificent 7").
It combines three powerful concepts into a single pane: Sector Breadth, Buying Aggression (TICK), and Trend Following.
1. The Core: Weighted vs. Unweighted Divergence
Weighted Histogram (The Generals): Represents the S&P 500 performance based on sector market cap (e.g., Tech/XLK has a ~33% impact, while Utilities/XLU has ~2%). When these bars are strong, the mega-caps are moving.
Unweighted Line (The Soldiers): Represents the average performance of all 11 sectors equally. When this line rises, there is broad market participation.
The Edge: Spot divergences. If the Weighted Bars are rising but the Unweighted Line is falling, the rally is narrow and potentially fragile (a "General's Rally").
2. The Iceberg: Cumulative TICK
A scaled cumulative TICK line is plotted in the background (the "Iceberg").
This visualizes the raw buying vs. selling aggression on the NYSE throughout the session.
Green Iceberg: Persistent buying pressure / accumulation.
Red Iceberg: Persistent selling pressure / distribution.
3. The Signal: Breadth Trend
Instead of generating signals on price, this script applies ATR Trailing Stop logic directly to the Weighted AD Line.
Buy Signal (B): Triggers when the internal sector strength breaks above its own volatility band.
Sell Signal (S): Triggers when sector momentum breaks down.
This often provides an earlier warning of trend changes than price action alone.
How to Use
Bullish Confirmation: Price is rising + Green Histogram + Green Iceberg + Unweighted Line rising.
Bearish Divergence: Price makes a new High, but the Breadth Bot prints a lower High or a Sell signal.
Rotation: If the Histogram is flat but the Unweighted Line is ripping higher, capital is rotating from Mega Caps into the broader market.
Settings:
Includes customizable weights for all 11 SPDR Sectors.
Adjustable "Visual Divisor" for the TICK to fit it perfectly behind your sector data.
Customizable ATR settings for the Breadth signals.
It combines three powerful concepts into a single pane: Sector Breadth, Buying Aggression (TICK), and Trend Following.
1. The Core: Weighted vs. Unweighted Divergence
Weighted Histogram (The Generals): Represents the S&P 500 performance based on sector market cap (e.g., Tech/XLK has a ~33% impact, while Utilities/XLU has ~2%). When these bars are strong, the mega-caps are moving.
Unweighted Line (The Soldiers): Represents the average performance of all 11 sectors equally. When this line rises, there is broad market participation.
The Edge: Spot divergences. If the Weighted Bars are rising but the Unweighted Line is falling, the rally is narrow and potentially fragile (a "General's Rally").
2. The Iceberg: Cumulative TICK
A scaled cumulative TICK line is plotted in the background (the "Iceberg").
This visualizes the raw buying vs. selling aggression on the NYSE throughout the session.
Green Iceberg: Persistent buying pressure / accumulation.
Red Iceberg: Persistent selling pressure / distribution.
3. The Signal: Breadth Trend
Instead of generating signals on price, this script applies ATR Trailing Stop logic directly to the Weighted AD Line.
Buy Signal (B): Triggers when the internal sector strength breaks above its own volatility band.
Sell Signal (S): Triggers when sector momentum breaks down.
This often provides an earlier warning of trend changes than price action alone.
How to Use
Bullish Confirmation: Price is rising + Green Histogram + Green Iceberg + Unweighted Line rising.
Bearish Divergence: Price makes a new High, but the Breadth Bot prints a lower High or a Sell signal.
Rotation: If the Histogram is flat but the Unweighted Line is ripping higher, capital is rotating from Mega Caps into the broader market.
Settings:
Includes customizable weights for all 11 SPDR Sectors.
Adjustable "Visual Divisor" for the TICK to fit it perfectly behind your sector data.
Customizable ATR settings for the Breadth signals.
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.