OPEN-SOURCE SCRIPT
Composite Breadth Score

█ OVERVIEW
Composite Breadth Score (CBS) condenses three independent measures of market breadth into a single normalized 0-100 reading, giving you one line that answers the question: how healthy is market participation right now? The three components are participation breadth (percentage of stocks above their 200-day moving average), momentum breadth (McClellan Summation Index, percentile-ranked), and leadership breadth (ratio of new 52-week highs to total new highs plus new lows).
When all three dimensions confirm each other, the composite score pushes toward extremes. When they diverge, the score compresses toward the midline, surfacing deterioration that single-indicator approaches can miss.
█ CONCEPTS
Why three dimensions?
A market can rise on narrowing participation (a few mega-caps dragging an index higher while most stocks lag). It can also rise with broad participation but deteriorating momentum, or with strong momentum but collapsing leadership. Each failure mode shows up in a different breadth measure. CBS fuses all three so you do not have to watch three separate panes.
Component definitions
1 — Participation: the percentage of S&P 500 constituents trading above their 200-day moving average. This is sourced from `S5TH` (primary) or `MMTH` (fallback). Already scaled 0-100. Measures how many stocks are in long-term uptrends.
2 — Momentum: the McClellan Summation Index, computed as the running cumulative total of the McClellan Oscillator (19/39-period EMA differential of NYSE advancing minus declining issues). Because the Summation Index has no fixed range, it is normalized to 0-100 via percentile rank over a configurable lookback (default 252 bars, roughly one year of daily data).
3 — Leadership: new 52-week highs divided by the sum of new highs and new lows, multiplied by 100. When this reads above 50, new highs dominate; below 50, new lows dominate. Captures whether the market's leading edge is expanding or contracting.
Composite calculation
Each component is weighted (default equal at 33.3% each) and combined into a single score. Weights are user-adjustable. If the participation symbol is unavailable on your data feed, the indicator automatically reweights using only the two remaining components.
█ HOW TO USE
Reading the score
• Above 75: all three breadth dimensions are strong. Market internals confirm the trend. Historically associated with broad, durable rallies, though sustained readings above 75 can precede mean-reversion pullbacks.
• 50 midline: the dividing line between net-positive and net-negative breadth. Crossovers and crossunders of 50 are the most actionable signals for trend direction.
• Below 25: breadth is weak across all three dimensions. Market internals are not supporting price. Common during corrections, bear markets, or the exhaustion phase of a rally.
Divergence analysis
The most valuable use case is divergence: the price index (S&P 500, for example) makes a new high while CBS makes a lower high. This indicates narrowing participation, fading momentum, or deteriorating leadership, often well before price reverses.
Toggle Show Individual Components in the indicator settings to overlay all three normalized streams. This lets you identify which dimension is diverging.
Trend confirmation
CBS crossing above 50 from below, particularly when all three components are rising, is a broad confirmation signal. The inverse (crossing below 50 with all three falling) confirms deterioration.
█ FEATURES
• Fully configurable component weights, allowing you to emphasize whichever breadth dimension matters most to your approach.
• Adjustable McClellan EMA periods (default 19/39) and Summation Index percentile lookback (default 252).
• Configurable overbought, oversold, and participation warning thresholds.
• All data symbols exposed as inputs so you can substitute alternative advancing/declining or new high/new low feeds.
• Status table in the top-right corner showing current values and color-coded health for each component at a glance.
• Nine built-in alert conditions:
— Composite crossing above/below overbought, oversold, and midline levels
— McClellan Summation crossing above/below zero
— New Highs/New Lows ratio flipping bullish or bearish
— Participation dropping below the warning threshold
█ LIMITATIONS
• The McClellan Summation normalization uses percentile rank, which requires the full lookback period (default 252 bars) of data history to stabilize. Values during the initial warm-up period are unreliable.
• Participation data depends on `S5TH` or `MMTH` being available on your TradingView data plan. If neither resolves, the indicator degrades gracefully to a two-component composite and marks participation as "N/A" in the status table.
• The indicator is designed for daily timeframes on US equity indices. Using it on intraday charts or non-US markets will produce results based on whatever the underlying NYSE/S&P symbols report on that timeframe, which may not be meaningful.
• New highs and new lows data reflects NYSE-listed issues, which includes ETFs, preferreds, and closed-end funds. This is the standard feed; common-stock-only filtering is not available via these symbols.
█ NOTES
The default equal weighting (33.3/33.3/33.3) treats all three breadth dimensions as equally important. You may find that adjusting weights improves the signal for your specific use case. For example, weighting participation more heavily produces a score that better captures structural regime shifts, while weighting leadership more heavily makes the score more sensitive to short-term rotations.
The indicator can be applied to any chart symbol. All data is pulled from fixed external symbols regardless of what chart you are viewing.
Composite Breadth Score (CBS) condenses three independent measures of market breadth into a single normalized 0-100 reading, giving you one line that answers the question: how healthy is market participation right now? The three components are participation breadth (percentage of stocks above their 200-day moving average), momentum breadth (McClellan Summation Index, percentile-ranked), and leadership breadth (ratio of new 52-week highs to total new highs plus new lows).
When all three dimensions confirm each other, the composite score pushes toward extremes. When they diverge, the score compresses toward the midline, surfacing deterioration that single-indicator approaches can miss.
█ CONCEPTS
Why three dimensions?
A market can rise on narrowing participation (a few mega-caps dragging an index higher while most stocks lag). It can also rise with broad participation but deteriorating momentum, or with strong momentum but collapsing leadership. Each failure mode shows up in a different breadth measure. CBS fuses all three so you do not have to watch three separate panes.
Component definitions
1 — Participation: the percentage of S&P 500 constituents trading above their 200-day moving average. This is sourced from `S5TH` (primary) or `MMTH` (fallback). Already scaled 0-100. Measures how many stocks are in long-term uptrends.
2 — Momentum: the McClellan Summation Index, computed as the running cumulative total of the McClellan Oscillator (19/39-period EMA differential of NYSE advancing minus declining issues). Because the Summation Index has no fixed range, it is normalized to 0-100 via percentile rank over a configurable lookback (default 252 bars, roughly one year of daily data).
3 — Leadership: new 52-week highs divided by the sum of new highs and new lows, multiplied by 100. When this reads above 50, new highs dominate; below 50, new lows dominate. Captures whether the market's leading edge is expanding or contracting.
Composite calculation
Each component is weighted (default equal at 33.3% each) and combined into a single score. Weights are user-adjustable. If the participation symbol is unavailable on your data feed, the indicator automatically reweights using only the two remaining components.
█ HOW TO USE
Reading the score
• Above 75: all three breadth dimensions are strong. Market internals confirm the trend. Historically associated with broad, durable rallies, though sustained readings above 75 can precede mean-reversion pullbacks.
• 50 midline: the dividing line between net-positive and net-negative breadth. Crossovers and crossunders of 50 are the most actionable signals for trend direction.
• Below 25: breadth is weak across all three dimensions. Market internals are not supporting price. Common during corrections, bear markets, or the exhaustion phase of a rally.
Divergence analysis
The most valuable use case is divergence: the price index (S&P 500, for example) makes a new high while CBS makes a lower high. This indicates narrowing participation, fading momentum, or deteriorating leadership, often well before price reverses.
Toggle Show Individual Components in the indicator settings to overlay all three normalized streams. This lets you identify which dimension is diverging.
Trend confirmation
CBS crossing above 50 from below, particularly when all three components are rising, is a broad confirmation signal. The inverse (crossing below 50 with all three falling) confirms deterioration.
█ FEATURES
• Fully configurable component weights, allowing you to emphasize whichever breadth dimension matters most to your approach.
• Adjustable McClellan EMA periods (default 19/39) and Summation Index percentile lookback (default 252).
• Configurable overbought, oversold, and participation warning thresholds.
• All data symbols exposed as inputs so you can substitute alternative advancing/declining or new high/new low feeds.
• Status table in the top-right corner showing current values and color-coded health for each component at a glance.
• Nine built-in alert conditions:
— Composite crossing above/below overbought, oversold, and midline levels
— McClellan Summation crossing above/below zero
— New Highs/New Lows ratio flipping bullish or bearish
— Participation dropping below the warning threshold
█ LIMITATIONS
• The McClellan Summation normalization uses percentile rank, which requires the full lookback period (default 252 bars) of data history to stabilize. Values during the initial warm-up period are unreliable.
• Participation data depends on `S5TH` or `MMTH` being available on your TradingView data plan. If neither resolves, the indicator degrades gracefully to a two-component composite and marks participation as "N/A" in the status table.
• The indicator is designed for daily timeframes on US equity indices. Using it on intraday charts or non-US markets will produce results based on whatever the underlying NYSE/S&P symbols report on that timeframe, which may not be meaningful.
• New highs and new lows data reflects NYSE-listed issues, which includes ETFs, preferreds, and closed-end funds. This is the standard feed; common-stock-only filtering is not available via these symbols.
█ NOTES
The default equal weighting (33.3/33.3/33.3) treats all three breadth dimensions as equally important. You may find that adjusting weights improves the signal for your specific use case. For example, weighting participation more heavily produces a score that better captures structural regime shifts, while weighting leadership more heavily makes the score more sensitive to short-term rotations.
The indicator can be applied to any chart symbol. All data is pulled from fixed external symbols regardless of what chart you are viewing.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。