OPEN-SOURCE SCRIPT
Index Breadth % Above Key Moving Averages

Description:
This indicator measures the percentage of constituents in a selected index trading above a chosen moving average — a core read on market breadth and internal market health, beyond what price action on the index itself reveals.
What it does
Rather than calculating breadth from individual constituents (which runs into symbol-count limitations), this script pulls pre-aggregated breadth data feeds covering the S&P 500 (including 10 individual sectors), Nasdaq, Nasdaq 100, Dow Jones, Russell 2000/3000, and the broader market. You can select any of these markets and check the percentage above the 20, 50, 100, 150, or 200-day moving average.
Breadth Moving Average (new)
A configurable moving average of the breadth line itself has been added, with a choice of SMA, EMA, WMA, or HMA. This lets you track breadth momentum rather than just the absolute reading — a cross above the MA after a period of depressed breadth often precedes broader market expansion, while a cross below can flag internal deterioration before it shows up in price.
Features
-Selectable market and moving average length
-Configurable Greed/Fear zone thresholds with visual fill highlighting
-Breadth MA with four smoothing options
-Crossover markers (triangles) flagging momentum shifts
-Built-in alerts for MA crossovers and Greed/Fear zone entries
How to use it
Watch for breadth crossing above its own moving average while still in or near the Fear zone — this combination has historically flagged durable turns rather than short-lived bounces. Conversely, breadth crossing below its MA while elevated can warn of distribution before the index itself rolls over. Cross-referencing breadth across multiple indices (e.g., S&P 500 vs. Nasdaq 100) helps identify whether market strength is broad-based or concentrated in a handful of names.
Credit
Original breadth data implementation by Esti0000. This version adds the breadth moving average, crossover detection, alert conditions, and visual enhancements. Published under the same Mozilla Public License 2.0.
This indicator measures the percentage of constituents in a selected index trading above a chosen moving average — a core read on market breadth and internal market health, beyond what price action on the index itself reveals.
What it does
Rather than calculating breadth from individual constituents (which runs into symbol-count limitations), this script pulls pre-aggregated breadth data feeds covering the S&P 500 (including 10 individual sectors), Nasdaq, Nasdaq 100, Dow Jones, Russell 2000/3000, and the broader market. You can select any of these markets and check the percentage above the 20, 50, 100, 150, or 200-day moving average.
Breadth Moving Average (new)
A configurable moving average of the breadth line itself has been added, with a choice of SMA, EMA, WMA, or HMA. This lets you track breadth momentum rather than just the absolute reading — a cross above the MA after a period of depressed breadth often precedes broader market expansion, while a cross below can flag internal deterioration before it shows up in price.
Features
-Selectable market and moving average length
-Configurable Greed/Fear zone thresholds with visual fill highlighting
-Breadth MA with four smoothing options
-Crossover markers (triangles) flagging momentum shifts
-Built-in alerts for MA crossovers and Greed/Fear zone entries
How to use it
Watch for breadth crossing above its own moving average while still in or near the Fear zone — this combination has historically flagged durable turns rather than short-lived bounces. Conversely, breadth crossing below its MA while elevated can warn of distribution before the index itself rolls over. Cross-referencing breadth across multiple indices (e.g., S&P 500 vs. Nasdaq 100) helps identify whether market strength is broad-based or concentrated in a handful of names.
Credit
Original breadth data implementation by Esti0000. This version adds the breadth moving average, crossover detection, alert conditions, and visual enhancements. Published under the same Mozilla Public License 2.0.
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.