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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。