OPEN-SOURCE SCRIPT
Cập nhật Sector Rotation Dashboardr

Sector Rotation Dashboard
Understanding where institutional money is moving before and after the opening bell gives traders a massive edge. This indicator is a real-time capital rotation tracker that maps the relative performance of all 11 Select Sector SPDR ETFs (representing the entire S&P 500) across all trading sessions.
Unlike standard dashboards that only look at regular market data, this script dynamically loops in premarket and after-hours data, updating relative performance calculations dynamically on every tick.
How It Works
The script actively fetches performance data by comparing the current extended hours or regular session price against the previous regular session close. It automatically pulls and handles 11 critical market sectors:
Technology (XLK)
Financials (XLF)
Health Care (XLV)
Consumer Discretionary (XLY)
Consumer Staples (XLP)
Energy (XLE)
Utilities (XLU)
Industrials (XLI)
Materials (XLB)
Real Estate (XLRE)
Communication Services (XLC)
Key Features
Live Session Tracking: Built-in intelligence automatically detects whether the market is in Premarket Hours, Regular Market Hours, or After Hours based on exchange times.
Real-time Bubble Sort Engine: The script actively sorts the 11 sectors from strongest to weakest on the last bar, so the leading sectors are always pushed to the top of your UI.
Automated Capital Rotation Insight: At the bottom of the table, a dynamic AI-style macro text block summarizes the state of the market. For example, it might read: "During Premarket Hours, capital is rotating heavily into Technology (XLK)... Conversely, liquidity is draining from Utilities (XLU)."
Fully Customizable UI: Change the dashboard placement (Top Right, Bottom Left, etc.) and text scaling seamlessly via the script settings to perfectly fit your workspace layout.
How to Trade with It
Spot Early Momentum (Premarket): Look at the dashboard 30–60 minutes before the open. If Defensive sectors (XLU, XLP) are leading while Aggressive sectors (XLK, XLY) are bleeding liquidity, expect a risk-off environment at the opening bell.
Relative Strength / Weakness Trading: When looking for long setups, focus on individual stocks inside the top 2 leading sectors. For shorting or put options, look at names within the lagging bottom sectors.
Identify Intraday Rotations: Watch for shifts during regular market hours where a beaten-down sector suddenly starts climbing the ladder, signaling algorithmic or institutional accumulation.
Developer Note: Uses optimized request.security structures to pull seamless extended historical data without dragging down chart loading speeds or causing layout shifting.
Understanding where institutional money is moving before and after the opening bell gives traders a massive edge. This indicator is a real-time capital rotation tracker that maps the relative performance of all 11 Select Sector SPDR ETFs (representing the entire S&P 500) across all trading sessions.
Unlike standard dashboards that only look at regular market data, this script dynamically loops in premarket and after-hours data, updating relative performance calculations dynamically on every tick.
How It Works
The script actively fetches performance data by comparing the current extended hours or regular session price against the previous regular session close. It automatically pulls and handles 11 critical market sectors:
Technology (XLK)
Financials (XLF)
Health Care (XLV)
Consumer Discretionary (XLY)
Consumer Staples (XLP)
Energy (XLE)
Utilities (XLU)
Industrials (XLI)
Materials (XLB)
Real Estate (XLRE)
Communication Services (XLC)
Key Features
Live Session Tracking: Built-in intelligence automatically detects whether the market is in Premarket Hours, Regular Market Hours, or After Hours based on exchange times.
Real-time Bubble Sort Engine: The script actively sorts the 11 sectors from strongest to weakest on the last bar, so the leading sectors are always pushed to the top of your UI.
Automated Capital Rotation Insight: At the bottom of the table, a dynamic AI-style macro text block summarizes the state of the market. For example, it might read: "During Premarket Hours, capital is rotating heavily into Technology (XLK)... Conversely, liquidity is draining from Utilities (XLU)."
Fully Customizable UI: Change the dashboard placement (Top Right, Bottom Left, etc.) and text scaling seamlessly via the script settings to perfectly fit your workspace layout.
How to Trade with It
Spot Early Momentum (Premarket): Look at the dashboard 30–60 minutes before the open. If Defensive sectors (XLU, XLP) are leading while Aggressive sectors (XLK, XLY) are bleeding liquidity, expect a risk-off environment at the opening bell.
Relative Strength / Weakness Trading: When looking for long setups, focus on individual stocks inside the top 2 leading sectors. For shorting or put options, look at names within the lagging bottom sectors.
Identify Intraday Rotations: Watch for shifts during regular market hours where a beaten-down sector suddenly starts climbing the ladder, signaling algorithmic or institutional accumulation.
Developer Note: Uses optimized request.security structures to pull seamless extended historical data without dragging down chart loading speeds or causing layout shifting.
Phát hành các Ghi chú
Fixed chart displayPhát hành các Ghi chú
Fixing chartMã 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.