OPEN-SOURCE SCRIPT

Sector Breadth Balance [Pineify]

437
Sector Breadth Balance [Pineify]

Overview
Sector Breadth Balance compares eleven editable sector proxies. It separates direction, participation, dispersion, leaders, and coverage to show whether a basket move is broad or narrow. It is context, not a forecast or signal.

Problem Definition
A weighted index can rise while most sectors are weak because large components dominate. An advance/decline count treats marginal and large volatility-adjusted moves equally, ignores return separation, and can appear complete when symbols lack matching bars. The same direction may mean broad participation, narrow leadership, or missing data. It measures the chosen basket directly.

Design Rationale
Close-to-EMA distance is divided by each symbol's ATR to compare scales. Saturation limits an extreme member; a separate vote preserves participation. Horizon returns are centered on the basket mean, making dispersion an internal separation measure. Equal membership favors breadth over index replication, so symbol choice matters. Dispersion penalizes disagreement, while square-root coverage lowers confidence without discarding partial data.

Key Features
  • Eleven symbols with matching-bar checks.
  • ATR-normalized trend and direction votes.
  • Return dispersion and leader/lagger counts.
  • Confirmed broad, narrow, mixed, and insufficient states.
  • Optional explanatory layers.


How It Works
Each request returns close-to-EMA distance divided by ATR and log return over the selected horizon. Both values must exist on the matching bar; gaps are not filled.

Trend x becomes x divided by the saturation scale plus absolute x, and bounded values are averaged. Members outside neutral distance cast positive or negative votes. Net votes divided by valid membership form vote balance. Returns are centered on the basket mean and dispersion is calculated. Dispersion share is dispersion divided by dispersion plus absolute mean return, rising when internal separation dominates.

With enough symbols, the score combines 62% mean trend and 38% vote balance, applies dispersion penalty and square-root coverage, then scales to -100 through +100. Broad candidates also need minimum participation. High dispersion with a signed mean is narrow; otherwise it is mixed. States change only at bar close and use a lower release threshold. Leaders and laggers exceed a configurable fraction of dispersion.

How Multiple Indicators Work Together
EMA distance supplies direction; ATR and saturation make influence comparable and bounded. Votes reveal participation hidden by an average. Centered returns and dispersion reveal concentration hidden by counts. Coverage prevents incomplete baskets from appearing reliable, while confirmed states make transitions auditable. Each layer changes the analytical question.

Trading Ideas and Insights
Use broad state to check whether a directional thesis has basket participation. Narrow highlights leaders and laggers without implying reversal. Mixed supports neither broad agreement nor a concentrated signed move. Compare breakouts with breadth diffusion, or leader growth with a score that fails to confirm. These observations do not estimate returns or define execution.

Unique Aspects
The contribution is a four-part decomposition: bounded normalized trend, vote balance, dispersion share, and synchronized coverage. Dispersion changes the score, selects narrow states, and defines leader bands; coverage changes readiness and visual confidence. This independent implementation uses no imported or reverse-engineered source.

How to Use
  1. Use a standard chart; target 4H through 1W.
  2. Select comparable symbols and sessions; defaults are US sector SPDR proxies.
  3. Read the track first: cyan is broad upside, coral downside, gold narrow, violet mixed, and gray insufficient.
  4. Use secondary layers to explain roles and missing data.
  5. Apply separate execution and risk rules.


Customization
EMA and ATR lengths set direction and normalization. Return length changes the cross-section. Neutral distance changes voting; saturation changes extreme influence. Entry score, participation, dispersion share, and release ratio define states and hysteresis. Leader band affects roles, not the score. Minimum valid symbols controls coverage. Display switches do not change calculations.

Assumptions and Limitations
The basket must be comparable, and equal membership must fit the question. The model ignores weights, currencies, distributions, survivorship, and causes of dispersion. EMA and ATR lag. Asynchronous sessions are missing rather than stale; mismatched calendars reduce coverage. Each member needs enough history.

Live score, columns, roles, and table can change; states and alerts wait for bar close. Data or setting changes can recalculate results. No future lookahead or negative offset is used, but no universal non-repainting claim is made. It is not constituent breadth, order flow, cost, or performance analysis.

Conclusion
Sector Breadth Balance creates an inspectable direction-participation-concentration map. Strong readings require comparable trends, agreement, acceptable dispersion, and matching coverage. It qualifies market internals; it does not replace risk analysis.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.