OPEN-SOURCE SCRIPT
Advance-Decline Line

Advance-Decline Line — Market Breadth Indicator
The NYSE Advance-Decline Line measures the internal health of the broad market by tracking how many stocks are actually participating in any given move — not just the mega-caps driving the index.
Every session the NYSE reports how many stocks closed up (advances) vs. down (declines). This indicator plots the raw daily difference as a histogram and applies two EMAs to identify the underlying breadth trend, cutting through daily noise to reveal the true market regime.
Why price alone isn't enough
The S&P 500 is market-cap weighted. Apple, Microsoft, and Nvidia can hold the index up while the other 490 stocks quietly deteriorate. The A/D Line weights every stock equally — exposing that divergence immediately. The classic example: the NYSE A/D Line peaked nearly two years before the Nasdaq crashed in 2000, giving attentive traders ample warning.
Background color — the regime signal
🟢 Green — Fast EMA > Slow EMA AND Slow EMA > 0. Broad market breadth is healthy. Favorable conditions for long positions.
🟠 Orange — Mixed signals. One condition is met but not both. Breadth is transitioning — proceed with caution.
🔴 Red — Fast EMA < Slow EMA AND Slow EMA < 0. Breadth is weak across most stocks. Historically, breakouts fail at a much higher rate in this regime.
Histogram bars
Each bar shows the raw daily breadth pulse — teal when more stocks advanced, red when more declined. Individual bars provide context; the background color reflects the dominant trend via the two EMAs.
Settings
Fast EMA (default 50)
Slow EMA (default 200) — moves slowly, only reverses during genuine regime shifts
Alerts
Breadth Turning Bullish — Fast EMA crossed above Slow EMA
Breadth Turning Bearish — Fast EMA crossed below Slow EMA
Slow EMA Above Zero — breadth trend fully positive
Slow EMA Below Zero — breadth trend fully negative
The NYSE Advance-Decline Line measures the internal health of the broad market by tracking how many stocks are actually participating in any given move — not just the mega-caps driving the index.
Every session the NYSE reports how many stocks closed up (advances) vs. down (declines). This indicator plots the raw daily difference as a histogram and applies two EMAs to identify the underlying breadth trend, cutting through daily noise to reveal the true market regime.
Why price alone isn't enough
The S&P 500 is market-cap weighted. Apple, Microsoft, and Nvidia can hold the index up while the other 490 stocks quietly deteriorate. The A/D Line weights every stock equally — exposing that divergence immediately. The classic example: the NYSE A/D Line peaked nearly two years before the Nasdaq crashed in 2000, giving attentive traders ample warning.
Background color — the regime signal
🟢 Green — Fast EMA > Slow EMA AND Slow EMA > 0. Broad market breadth is healthy. Favorable conditions for long positions.
🟠 Orange — Mixed signals. One condition is met but not both. Breadth is transitioning — proceed with caution.
🔴 Red — Fast EMA < Slow EMA AND Slow EMA < 0. Breadth is weak across most stocks. Historically, breakouts fail at a much higher rate in this regime.
Histogram bars
Each bar shows the raw daily breadth pulse — teal when more stocks advanced, red when more declined. Individual bars provide context; the background color reflects the dominant trend via the two EMAs.
Settings
Fast EMA (default 50)
Slow EMA (default 200) — moves slowly, only reverses during genuine regime shifts
Alerts
Breadth Turning Bullish — Fast EMA crossed above Slow EMA
Breadth Turning Bearish — Fast EMA crossed below Slow EMA
Slow EMA Above Zero — breadth trend fully positive
Slow EMA Below Zero — breadth trend fully negative
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.