OPEN-SOURCE SCRIPT
Updated

Nifty Breadth [Top 20 Movers]

2 822
This is a comprehensive, real-time market breadth dashboard for the NSE (National Stock Exchange of India), tracking 40 (out of 50) of the most prominent Nifty stocks across 9 sectors. It displays the top 20 gainers and losers, advance/decline statistics, and sector-level breadth — all inside a single, elegantly formatted overlay table.

Key Features:-
Performance Mode — The indicator supports both Daily and Weekly timeframes, switchable via a simple dropdown input. This allows traders to instantly toggle between intraday close-to-close and week-over-week performance views without modifying any code.

Top 20 Movers Panel — The dashboard ranks all 40 (out of 50) tracked stocks by percentage change and displays the top 10 gainers and top 10 losers in a two-column layout each, making it easy to spot the strongest and weakest names at a glance. Each row shows the stock symbol, percentage change (with sign), and a proportional block bar that visually represents the magnitude of the move.

Emoji Highlights — The top gainer is flagged with a 🔥 icon and the steepest loser with a ❄️ icon, making the outliers immediately identifiable. This feature can be toggled on or off from the settings.

Advance / Decline Breadth Panel — A dedicated panel summarizes market sentiment across all 40 stocks, showing the raw count of advances, declines, and unchanged stocks, their percentage breakdown, and a 10-block visual bar that fills green for advancing and red for declining proportion.

Sector Breadth Panel — All 40 stocks are mapped to one of 9 sectors — Banking, IT, Auto, Pharma, Energy, Metals, FMCG, Infra, and Miscellaneous. For each sector, the dashboard shows how many constituent stocks are advancing versus declining, color-coded with unique accent colors per sector for quick visual separation.

Customization Options
The indicator exposes several user-facing inputs to personalize the display without touching the code. The table position can be placed at any of nine screen locations. Bar scale percentage and maximum block count control the visual width of the performance bars. Text sizes for the title, headers, and data rows can be independently set to Tiny, Small, Normal, or Large, making the dashboard adaptable to different screen resolutions and chart layouts.

Technical Implementation: -
The script uses request.security() calls to fetch close prices across all 40 symbols on the selected timeframe, calculates percentage change relative to the prior bar, and stores results in arrays. It then uses array.sort_indices() to rank stocks in both ascending and descending order for the gainers and losers panels respectively. The entire table is rendered only on the last bar using barstate.islast to avoid redundant rendering. A timestamp in IST (Asia/Kolkata) is shown in the footer.

Usage Notes:-
This indicator is designed as an overlay on any NSE chart. It does not generate buy or sell signals — it is a purely market breadth and sentiment monitoring tool intended to give Indian traders a structured, data-rich overview of the Nifty universe in a single view. Best used as a companion panel on a dedicated blank chart or index chart window. Enjoy !!
Release Notes
🎨 Colour Palette

Background deepened to near-black navy (#03060f) for better contrast
Title bar upgraded to deep indigo; frame now glows with electric cyan
Green → vivid mint #00e676, Red → vivid crimson #ff3d57
Neutral text upgraded to icy-blue instead of flat grey

🔠 Title & Headers

Title wrapped with ⬡ hex decorators: ⬡ NIFTY 50 · TOP 20 MOVERS + BREADTH · Daily ⬡
Section headers now read ▲ TOP GAINERS / ▼ TOP LOSERS / ◈ A/D BREADTH / ◈ SECTOR BREADTH with distinct dark-tinted backgrounds per section
Column header text changed from plain white to electric cyan for visual pop

📊 Bar Characters

All █ blocks replaced with ▰ (filled lozenge) — more elegant and modern
Sector inline mini-bars use ▸ arrows for a compact sparkline feel

🏆 Rank Numbers

Changed from dull grey to metallic silver #b0bec5

📍 Sector Panel

Each sector row now shows mini arrow bars: ◆ Banking 3↑ ▸▸▸ 1↓ ▸
Sector colour wheel upgraded to vivid, distinct hues (electric blue, violet-pink, amber, lime, coral, etc.)

🔻 Footer

Centred, styled in soft blue with ⬡ bookends and a cleaner separator format

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.