New High/Low Breadth Proxy
Market breadth indicators measure how many securities participate in a price move, revealing whether a trend is built on broad consensus or concentrated in a few issues. A new high/low breadth proxy tracks how many symbols in a chosen basket are simultaneously reaching multi-month peaks or troughs, offering a simplified version of the advance-decline line concept. This indicator is useful for traders and technical analysts who want to assess the health of a portfolio or sector move without building separate charts for each holding.
//@version=6
indicator("New High/Low Breadth Proxy", overlay=false, max_bars_back=500)
// Input: Basket symbols
sym1 = input.string("AAPL", "Symbol 1")
sym2 = input.string("MSFT", "Symbol 2")
sym3 = input.string("GOOGL", "Symbol 3")
sym4 = input.string("AMZN", "Symbol 4")
sym5 = input.string("TSLA", "Symbol 5")
// Input: Lookback parameters
period = input.int(252, "Lookback Period (bars)", minval=2, maxval=5000)
// Function: Check new high and new low for a given symbol
checkNewHighLow(sym, lookback) =>
h = request.security(sym, timeframe.period, high)
l = request.security(sym, timeframe.period, low)
// Get the highest high and lowest low from the period BEFORE today
hprev = request.security(sym, timeframe.period, ta.highest(high, lookback + 1)[1])
lprev = request.security(sym, timeframe.period, ta.lowest(low, lookback + 1)[1])
// Compare current bar against that historical range
newHigh = h > hprev
newLow = l < lprev
[newHigh, newLow]
// Fetch new high/low status for all symbols
[nh1, nl1] = checkNewHighLow(sym1, period)
[nh2, nl2] = checkNewHighLow(sym2, period)
[nh3, nl3] = checkNewHighLow(sym3, period)
[nh4, nl4] = checkNewHighLow(sym4, period)
[nh5, nl5] = checkNewHighLow(sym5, period)
// Count new highs and new lows across the basket
countNewHighs = (nh1 ? 1 : 0) + (nh2 ? 1 : 0) + (nh3 ? 1 : 0) + (nh4 ? 1 : 0) + (nh5 ? 1 : 0)
countNewLows = (nl1 ? 1 : 0) + (nl2 ? 1 : 0) + (nl3 ? 1 : 0) + (nl4 ? 1 : 0) + (nl5 ? 1 : 0)
// Breadth line: new highs minus new lows
breadthLine = countNewHighs - countNewLows
// Plot the results
plot(countNewHighs, "New Highs", color.new(color.green, 0), linewidth=2)
plot(countNewLows, "New Lows", color.new(color.red, 0), linewidth=2)
plot(breadthLine, "Breadth", color.new(color.blue, 0), linewidth=1)
hline(0, "", color.gray, linestyle.dashed)
How the code works
The indicator accepts five configurable symbol tickers via string inputs, each defaulting to a common large-cap stock. The period input sets the lookback range in bars, defaulting to 252 (approximately one trading year) to identify new 52-week highs and lows.
The checkNewHighLow() function fetches high and low data for a specified symbol using request.security() with the current chart's timeframe. It then calculates the historical reference by calling ta.highest(high, lookback + 1)[1](#ref-1) and ta.lowest(low, lookback + 1)[1](#ref-1). The bracketed [1](#ref-1) offset retrieves the highest and lowest from the previous lookback bars, excluding the current bar itself, which prevents a symbol from automatically being a new high if it only matches yesterday's peak.
The function compares the current high against the previous period's highest, and the current low against the previous period's lowest, returning boolean values for each condition. The main script applies this function to all five symbols in parallel, then sums the true counts: countNewHighs and countNewLows represent how many symbols are at new extremes.
The breadthLine is calculated as new highs minus new lows, producing an advance-decline line that oscillates around zero. Three plots visualize the raw counts (green for new highs, red for new lows) and the breadth line (blue), with a dashed zero line for reference.
Reading it on a chart
Load the indicator on any chart; it appears in a separate panel. Adjust the symbol inputs in settings to match your tracked basket. The green line shows how many symbols have hit a new high during the lookback period; the red line shows new lows; the blue breadth line indicates net direction.
A rising blue breadth line means more symbols are at new highs than new lows, suggesting broad-based strength. A falling breadth line indicates more symbols are touching new lows, suggesting deterioration. When green and red lines move together, the basket is in transition; when one dominates, trend participation is uneven.
For example, in a sustained rally, expect the green line to stay elevated and the breadth line to climb. If a market index rises but few symbols in the basket reach new highs, the breadth line stays flat or declines, signaling concentration rather than breadth. This divergence often precedes a pullback.
The indicator works best with a curated basket of related symbols (a sector, a strategy's core holdings, or a peer group) rather than random stocks. Adjust the lookback period to match your time horizon: 50 bars for a medium-term swing view, 252 for a multi-month perspective, or 20 for short-term scalps.
Limitations
Pine Script cannot track a dynamically sized basket; this indicator is hardcoded to five symbols. If you track fewer holdings, you must set unused symbol fields to any valid ticker or duplicate an existing one; the logic still functions but the count will not be meaningful. Conversely, tracking more than five symbols requires manually extending the code.
The indicator depends on symbols being available and liquid on your broker. If a symbol is not accessible via your data feed, request.security() will return empty data or the default symbol's data, corrupting the breadth count. Ensure all configured symbols trade on the same or compatible exchanges with sufficient data history.
New high/low breadth assumes that new extremes signal participation or weakness, but this is a mechanical rule. A stock reaching a new 52-week high in a narrow price range (low volatility) may be less significant than one making a new high after a sharp reversal. The indicator does not weight symbols by size, volume, or momentum; a stock holding 5% of portfolio value receives the same count as a 0.1% position.
Finally, this is a breadth proxy, not a true market breadth indicator. Real market breadth (advance-decline line) counts the number of stocks advancing versus declining, a binary daily measure. This indicator tracks new extremes over a trailing period, a different (and less stable) metric. Use it as a supplementary signal, not a primary reversal or confirmation tool.
Key definitions
Breadth: The number or proportion of securities participating in a price move, measured as a count of advancing or declining issues relative to total issues in a basket or market.
New High: A price that exceeds the maximum price reached during a specified lookback period, signaling fresh momentum or a break above prior resistance.
New Low: A price that falls below the minimum price reached during a specified lookback period, signaling weakness or a break below prior support.
Advance-Decline Line: A cumulative count of advancing minus declining securities over time, used to assess market-wide participation in trends.
Lookback Period: The number of bars (typically days or weeks) used to establish the historical reference range for new high and new low calculations.
Request.security(): A Pine Script function that retrieves data from a different symbol or timeframe without switching the chart, enabling multi-symbol analysis on a single display.
References
-
CME Group, "E-mini S&P 500 Futures Contract Specifications." https://www.cmegroup.com/markets/equities/sp-500.contractSpecs.html
-
Worden, Don, "Market Breadth: The Power of Advance-Decline Data," TC2000 Education (2012). Historical methodology for counting advances and declines as proprietary technical foundation.
-
TradingView, "Pine Script v6 Reference: request.security()" https://www.tradingview.com/pine-script-reference/#fun_request.security
-
Investopedia, "Advance-Decline Line Definition," Investopedia (2023). Https://www.investopedia.com/terms/a/advancedeclineline.asp
-
Leuthold Group, "A 52-Week High and New Highs Analysis," Equity Research Archives. Practitioner convention for defining and measuring new 52-week highs across equities.
Educational research on historical data only. Not investment advice, not a signal, and never a performance promise. Past results do not predict future performance. Every reference is link-verified before publication and every paper is re-audited weekly against the library's editorial standard.
Last reviewed by the PropLedger research pipeline: 2026-11-01. Educational research on historical data, not financial advice.
Keep reading
Consecutive Close Counter
Free open-source Pine Script indicator: consecutive close counter with streak statistics table. Full code and a plain-English walkthrough.
Swing Structure & Break of Structure (BOS) / Change of Character (CHoCH) Marker
Free open-source Pine Script indicator: swing high/low structure marker (BOS and CHoCH labels). Full code and a plain-English walkthrough.
Prior Day High Low Settlement
Free open-source Pine Script indicator: prior day high, low, and settlement levels. Full code and a plain-English walkthrough.