OPEN-SOURCE SCRIPT

Breadth Topping Syndrome

736
This indicator plots a normalized breadth deterioration score in a separate pane and fires a discrete topping signal when several independent NYSE internal breadth conditions assemble while the market is still rising. The thesis is that major tops are a syndrome, not a single event: internal bifurcation, weakening participation and fading leadership tend to appear together near distributive peaks, and their conjunction inside an uptrend carries more information than any one of them alone.


OVERVIEW

Breadth Topping Syndrome (BTS) condenses four warning conditions into one framework:

- C1: a Miekka style divergence, where NYSE new 52 week highs and new 52 week lows are
simultaneously elevated as a percentage of advances plus declines.
- C2: Norman Fosback's High Low Logic Index at a high percentile of its own trailing history.
- C3: weak S&P 500 participation (percentage of constituents above their 200 day moving
average) while the trend reference index is in an uptrend.
- C4: a weighted deterioration score built from the same normalized components exceeding
a threshold.

When a configurable minimum number of these conditions has been observed within a short synchronization span and the trend gate is up, a trigger fires and opens a signal window. Inside the window the syndrome is Active only while the McClellan Oscillator is negative. Repeated triggers within a trailing lookback are counted as a cluster.


HISTORY / BACKGROUND

The components have documented lineages. The simultaneous new highs and new lows divergence condition follows James R. Miekka's Hindenburg Omen specification (1995), itself derived from work by Martin Zweig and Norman Fosback: both extremes elevated at once, measured against advances plus declines, valid only in an uptrend, with the McClellan Oscillator acting as an activation gate inside a fixed window rather than as a co equal trigger. The High Low Logic Index is Fosback's, published in 1976: the minimum of new highs and new lows relative to total issues isolates the disagreement component of breadth. Percentage of stocks above the 200 day moving average is a standard participation measure. The McClellan Oscillator is the 19/39 period EMA differential of net advances, per Sherman and Marian McClellan.

The syndrome architecture that combines them is novel and is described in full below. The conceptual basis is that each component captures a different failure mode of an advance, so requiring several to appear near simultaneously filters the false positives that any single measure produces on its own.


HOW IT WORKS

The script requests seven external series at the chart timeframe: NYSE advancing issues, declining issues, new 52 week highs, new 52 week lows, a trend reference index, and a primary plus fallback participation symbol. All requests use ignore_invalid_symbol, and a data integrity gate suppresses every signal when any core feed returns no value.

On each bar the script computes:

- The Miekka ratios: new highs and new lows each divided by advances plus declines, times 100.
C1 is true when both meet the threshold.
- The High Low Logic Index: the minimum of new highs and new lows divided by advances plus
declines, times 100, smoothed with an EMA, then converted to a percentile rank over the
normalization lookback. C2 is true when the percentile meets the warning level.
- The participation percentile: the participation series (gap filled with its last valid value so feed
gaps do not distort the distribution) percentile ranked over the same lookback. C3 is true when
the percentile is at or below the warning level while the trend reference index is above its close
a configurable number of bars ago. This is the divergence conjunction: price rising, participation
weak relative to its own recent history.
- The leadership share: new highs divided by new highs plus new lows, times 100, percentile
ranked and inverted.
- The deterioration score: the weighted average of the HLLI percentile, the inverted participation
percentile and the inverted leadership percentile, scaled 0 to 100. If both participation symbols
fail to resolve, the score reweights automatically over the two remaining components. C4 is true
when the score meets its threshold.

Each condition contributes to the syndrome if it was true on any bar within the synchronization span. When the count of contributing conditions reaches the required minimum while the uptrend gate is true, a trigger fires on the first such bar (edge triggered, so a persisting syndrome does not retrigger). The trigger opens a signal window measured in trading days. Within the window, the syndrome is Active while the McClellan Oscillator, computed as the fast EMA minus the slow EMA of net advances, is below zero, and deactivates when it turns positive without closing the window. The cluster count is the number of triggers within the trailing cluster lookback.


HOW TO USE

The script is designed for the 1D timeframe. The breadth feeds are daily series, the window and cluster inputs are specified in trading days, and the Miekka and McClellan parameters are daily conventions, so daily resolution matches the granularity of the logic.

- Blue score line: current breadth deterioration, 0 to 100, against a dashed threshold line and a
dotted midline at 50. The line turns orange above the threshold and red while the syndrome
is Active. Gray indicates missing core data.
- Faint purple line: the HLLI percentile, shown separately because it is the slowest moving and
most historically studied component.
- Red triangle at the top of the pane: a syndrome trigger fired on that bar.
- Small maroon diamond: the Miekka condition alone was true on that bar without a full trigger,
useful for tracking the classical signal inside the broader framework.
- Maroon background: syndrome Active (inside a signal window with the McClellan Oscillator
negative). Orange background: window open but the oscillator is positive, so the syndrome is
temporarily deactivated and will reactivate if the oscillator turns negative before the window
expires.
- Status table (top right): overall state, each condition's current value and contribution, the
syndrome count, the oscillator value, bars remaining in the window, and the cluster count.

A single trigger is a caution flag. Two or more triggers within the cluster lookback have historically been the more serious configuration for divergence based breadth signals, and the script exposes a dedicated alert for that case. Four alerts are provided: trigger fired, syndrome turned Active, clustered trigger, and score crossing above its threshold.


SETTINGS

- Conditions Required (N of 4): syndrome count needed to trigger. Default 3.
- Condition Sync Span: bars within which a condition still counts toward the syndrome. Default 5.
- Signal Window: trading days a trigger keeps the window open. Default 30.
- Cluster Lookback: trailing trading days over which triggers are counted. Default 60.
- C1 Miekka NH/NL Threshold: minimum percent of advances plus declines for both new highs
and new lows. Default 2.8.
- C2 HLLI Warning Percentile: percentile of the smoothed HLLI that flags bifurcation. Default 90.
- C3 Participation Warning Percentile: participation percentile at or below which weakness is
flagged in an uptrend. Default 25.
- C4 Deterioration Score Threshold: score level that flags composite weakness. Default 75.
- Uptrend Lookback: bars over which the trend reference must have risen. Default 50.
- HLLI EMA Length: smoothing applied to the raw HLLI ratio. Default 50.
- Percentile Rank Lookback: window for all percentile ranks. Default 252.
- Score weights for the bifurcation, participation and leadership components. Default 33.3 each.
- MCO Fast EMA and Slow EMA: McClellan Oscillator periods. Defaults 19 and 39.
- Data Symbols: all seven feeds are exposed as string inputs and can be substituted.
- Show Status Table: toggles the table. Default on.


WHAT MAKES IT ORIGINAL

The individual components are public domain methods. What this script does differently is the combination architecture. First, every component is percentile ranked against its own trailing distribution before use, so the warning levels adapt to the prevailing breadth regime instead of relying on fixed absolute thresholds calibrated to a decades old NYSE universe. Second, the conditions are fused through an N of M syndrome count with a synchronization span, not a same bar AND, which acknowledges that breadth deterioration components rarely align to the exact day. Third, the trigger inherits the two phase Miekka mechanism but generalizes it: the syndrome, not a single divergence, opens the window, and the McClellan Oscillator gates activation inside it. Fourth, trigger clustering is quantified directly on the chart rather than left to visual inspection. This conjunction of adaptive normalization, tolerant multi condition assembly, windowed gating and cluster counting does not correspond to any single published method and is the substance of the script.


NOTES / LIMITATIONS

- The breadth feeds have limited historical depth. No signals can exist before the feeds begin,
and because every percentile rank requires the full normalization lookback (default 252 bars),
the first year of available feed history produces unreliable ranks and should be disregarded.
- The logic is designed for daily resolution. On other timeframes the external series return
whatever the feeds report at that resolution, and the day denominated windows lose their
intended meaning.
- All values on the developing realtime bar update until the bar closes. Signals should be
evaluated on closed bars. The script uses same timeframe requests with lookahead off and
does not reference future data.
- If neither participation symbol resolves, condition C3 can never contribute. With the default
requirement of 3 of 4, all three remaining conditions must then assemble, which makes
triggers strictly rarer. The table marks participation as N/A in that state.
- Data is pulled from fixed external symbols regardless of the chart symbol. The chart symbol
only determines the bar grid, so the indicator belongs on a US equity index chart at 1D.
- Breadth divergence signals of this family have a documented false positive history. This tool
flags conditions that have accompanied past tops. It is a risk assessment input, not a
standalone trading signal, and no claim is made about future results.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。