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.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。