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.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.