PROTECTED SOURCE SCRIPT
Diupdate Sector Monitor

✅ Custom Index Strength
Key Features:
Custom Indices: It mathematically combines stocks (like HDFC + ICICI + Kotak) to create a synthetic "Private Bank Index" that you can't find anywhere else. (Note all the stocks are Equal weighted)
Performance Tracking: Shows how much a sector has moved over 1 Day, 1 Week, 1 Month, etc.
RRG (Relative Rotation): A smart algorithm that tells you if a sector is leading the market or falling behind.
Understanding the "RRG" (Relative Rotation Graph)
This is the most powerful column in the table. It compares the sector against a benchmark (usually Nifty 500 EW) to tell you the "Health" of the trend.
It classifies every sector into one of four phases, similar to a clock cycle:
💚 Leading (Strong Trend): The sector is outperforming Nifty and momentum is strong. This is where the bulls are.
💛 Weakening (Taking a Breath): The sector is still strong, but it is starting to slow down. It might be time to book profits or wait.
❤️ Lagging (Weak Trend): The sector is underperforming. It is weak and losing money compared to the market. Avoid these.
💙 Improving (Waking Up): The sector was weak, but momentum is coming back. This is often where new trends start.
✅ RRG explained
Relative Strength (RS): how the sector is doing versus the benchmark today. RS = sector price divided by benchmark price.
Strength (X-axis): compare today’s RS with RS from (default 20) days ago . If today’s RS is higher than 20 days ago → Positive strength; lower → Negative.
Momentum (Y-axis): compare today’s RS with RS from (default 5) days ago . If today’s RS is higher than 5 days ago → Improving; lower → Worsening.
Numeric walk-through
Assume benchmark = 100 today, 95 (5D ago), 90 (20D ago).
Assume sector = 110 today, 100 (5D ago), 95 (20D ago).
RS today = 110 ÷ 100 = 1.10.
RS 5D ago = 100 ÷ 95 = 1.0526.
RS 20D ago = 95 ÷ 90 = 1.0556.
Strength (today vs 20D ago): RS moved from 1.0556 to 1.10 → about +4.2% → Positive.
Momentum (today vs 5D ago): RS moved from 1.0526 to 1.10 → about +4.5% → Improving.
Label: Positive + Improving = Leading.
Quick examples for each quadrant
(numbers are RS values; you can imagine each came from “sector ÷ benchmark”)
Leading (Positive & Improving)
RS(20D) 1.00 → RS(today) 1.10 ⇒ Strength +10% (Positive)
RS(5D) 1.05 → RS(today) 1.10 ⇒ Momentum +4.8% (Improving)
Weakening (Positive & Worsening)
RS(20D) 1.00 → RS(today) 1.08 ⇒ Strength +8% (Positive)
RS(5D) 1.12 → RS(today) 1.08 ⇒ Momentum −3.6% (Worsening)
Improving (Negative & Improving)
RS(20D) 1.05 → RS(today) 0.98 ⇒ Strength −6.7% (Negative)
RS(5D) 0.95 → RS(today) 0.98 ⇒ Momentum +3.2% (Improving)
Lagging (Negative & Worsening)
RS(20D) 1.00 → RS(today) 0.90 ⇒ Strength −10% (Negative)
RS(5D) 0.95 → RS(today) 0.90 ⇒ Momentum −5.3% (Worsening)
✅ 3. How to Use the Settings (Inputs)
When you open the settings menu, here is what each section controls:
Theme / Colors
Dark Mode: Check this if you use a dark background on Trading View.
Light Mode Theme: Choose between "Blue & Purple" or standard "Green & Red" for Up/Down colors.
RRG Settings
RRG Benchmark: What are we comparing our sectors to? usually, this is NIFTY 500 EW.
If Nifty is up 1% and your sector is up 2%, your sector is "Leading."
RS Period (Score): How far back do we look to check strength? (Default: 20). Lower numbers make it react faster; higher numbers make it smoother.
Momentum Lookback: How fast is the trend changing? (Default: 5).
Table Settings
Show Col 1 / 2 / 3: You can choose to see up to 3 timeframes plus the RRG column.
Timeframes (1D, 1W, 1M...): Set these to match your trading style.
Day Trader: Set Col 1 to 1D (1 Day) and Col 2 to 1W (1 Week).
Investor: Set Col 1 to 1M (1 Month) and Col 2 to 6M (6 Months).
Sort By: This is crucial. You can sort the table by "RRG" (to put the strongest sectors at the top) or by "Column 1" (to see today's biggest gainers).
Rows Shown: Limit the table to the "Top 10" or "Top 20" if the table is too big for your screen.
Symbol Selection
This is where the magic happens. The script comes pre-loaded with groups like "NBFC," "Housing Finance," etc.
Checkbox: Turn a specific sector ON or OFF in the table.
Input Box: You can actually edit the stocks!
Example: The input might look like NSE:TCS+NSE:INFY.
If you want to add Tech Mahindra, you simply add +NSE:TECHM to the text. The indicator will instantly recalculate the sector based on your new list.
✅4. Adjusting Inputs for Your Time Horizon
The logic is simple:
Lower Numbers: Make the indicator faster and more sensitive. It reacts quickly to price jumps but creates more "noise" (false signals).
Higher Numbers: Make the indicator slower and smoother. It filters out small corrections but reacts late to new trends.
Short-Term (Intraday / Fast Swing)
Recommended Inputs: Strength 10 | Momentum 3
Why: You need speed. By lowering the Strength to 10 days and Momentum to 3 days, the RRG will react instantly to sudden bursts of buying.
Best For: Catching "Micro-Rotations" (e.g., a sector suddenly waking up for a 2-3 day rally).
Trade-off: You will see sectors jump between "Leading" and "Weakening" very frequently.
Medium-Term (Standard Swing Trading)
Recommended Inputs: Strength 20 | Momentum 5 (Default)
Why: This is the "Goldilocks" zone. It ignores the daily noise but is fast enough to catch a trend that lasts for a few weeks.
Best For: Identifying the main theme of the current month.
Trade-off: Balanced. It might be slightly too slow for scalpers and slightly too fast for multi-year investors.
Long-Term (Position Investing)
Recommended Inputs: Strength 60 | Momentum 15
Why: A strength lookback of 60 (approx. 1 quarter) ensures you are only looking at major structural trends. A momentum of 15 ensures that a 2-day drop doesn't scare you out of a "Leading" sector.
Best For: Building a portfolio to hold for 6–12 months. If a sector is "Leading" here, it is in a massive bull run.
Trade-off: Very slow. By the time a sector turns "Leading," the trend has already been established for a while.
✅5. The "Secret" Tooltip Feature
Don't forget to hover your mouse cursor over the RRG Status text in the table (e.g., over the word "Leading").
A detailed box will appear showing:
Math: Exact Strength and Momentum scores.
Strategy: A text advice (e.g., "Trend is strong. Look for breakouts").
Constituents: The exact list of stocks used to calculate that sector's performance. This saves you from having to guess which stocks belong to that group.
Key Features:
Custom Indices: It mathematically combines stocks (like HDFC + ICICI + Kotak) to create a synthetic "Private Bank Index" that you can't find anywhere else. (Note all the stocks are Equal weighted)
Performance Tracking: Shows how much a sector has moved over 1 Day, 1 Week, 1 Month, etc.
RRG (Relative Rotation): A smart algorithm that tells you if a sector is leading the market or falling behind.
Understanding the "RRG" (Relative Rotation Graph)
This is the most powerful column in the table. It compares the sector against a benchmark (usually Nifty 500 EW) to tell you the "Health" of the trend.
It classifies every sector into one of four phases, similar to a clock cycle:
💚 Leading (Strong Trend): The sector is outperforming Nifty and momentum is strong. This is where the bulls are.
💛 Weakening (Taking a Breath): The sector is still strong, but it is starting to slow down. It might be time to book profits or wait.
❤️ Lagging (Weak Trend): The sector is underperforming. It is weak and losing money compared to the market. Avoid these.
💙 Improving (Waking Up): The sector was weak, but momentum is coming back. This is often where new trends start.
✅ RRG explained
Relative Strength (RS): how the sector is doing versus the benchmark today. RS = sector price divided by benchmark price.
Strength (X-axis): compare today’s RS with RS from (default 20) days ago . If today’s RS is higher than 20 days ago → Positive strength; lower → Negative.
Momentum (Y-axis): compare today’s RS with RS from (default 5) days ago . If today’s RS is higher than 5 days ago → Improving; lower → Worsening.
Numeric walk-through
Assume benchmark = 100 today, 95 (5D ago), 90 (20D ago).
Assume sector = 110 today, 100 (5D ago), 95 (20D ago).
RS today = 110 ÷ 100 = 1.10.
RS 5D ago = 100 ÷ 95 = 1.0526.
RS 20D ago = 95 ÷ 90 = 1.0556.
Strength (today vs 20D ago): RS moved from 1.0556 to 1.10 → about +4.2% → Positive.
Momentum (today vs 5D ago): RS moved from 1.0526 to 1.10 → about +4.5% → Improving.
Label: Positive + Improving = Leading.
Quick examples for each quadrant
(numbers are RS values; you can imagine each came from “sector ÷ benchmark”)
Leading (Positive & Improving)
RS(20D) 1.00 → RS(today) 1.10 ⇒ Strength +10% (Positive)
RS(5D) 1.05 → RS(today) 1.10 ⇒ Momentum +4.8% (Improving)
Weakening (Positive & Worsening)
RS(20D) 1.00 → RS(today) 1.08 ⇒ Strength +8% (Positive)
RS(5D) 1.12 → RS(today) 1.08 ⇒ Momentum −3.6% (Worsening)
Improving (Negative & Improving)
RS(20D) 1.05 → RS(today) 0.98 ⇒ Strength −6.7% (Negative)
RS(5D) 0.95 → RS(today) 0.98 ⇒ Momentum +3.2% (Improving)
Lagging (Negative & Worsening)
RS(20D) 1.00 → RS(today) 0.90 ⇒ Strength −10% (Negative)
RS(5D) 0.95 → RS(today) 0.90 ⇒ Momentum −5.3% (Worsening)
✅ 3. How to Use the Settings (Inputs)
When you open the settings menu, here is what each section controls:
Theme / Colors
Dark Mode: Check this if you use a dark background on Trading View.
Light Mode Theme: Choose between "Blue & Purple" or standard "Green & Red" for Up/Down colors.
RRG Settings
RRG Benchmark: What are we comparing our sectors to? usually, this is NIFTY 500 EW.
If Nifty is up 1% and your sector is up 2%, your sector is "Leading."
RS Period (Score): How far back do we look to check strength? (Default: 20). Lower numbers make it react faster; higher numbers make it smoother.
Momentum Lookback: How fast is the trend changing? (Default: 5).
Table Settings
Show Col 1 / 2 / 3: You can choose to see up to 3 timeframes plus the RRG column.
Timeframes (1D, 1W, 1M...): Set these to match your trading style.
Day Trader: Set Col 1 to 1D (1 Day) and Col 2 to 1W (1 Week).
Investor: Set Col 1 to 1M (1 Month) and Col 2 to 6M (6 Months).
Sort By: This is crucial. You can sort the table by "RRG" (to put the strongest sectors at the top) or by "Column 1" (to see today's biggest gainers).
Rows Shown: Limit the table to the "Top 10" or "Top 20" if the table is too big for your screen.
Symbol Selection
This is where the magic happens. The script comes pre-loaded with groups like "NBFC," "Housing Finance," etc.
Checkbox: Turn a specific sector ON or OFF in the table.
Input Box: You can actually edit the stocks!
Example: The input might look like NSE:TCS+NSE:INFY.
If you want to add Tech Mahindra, you simply add +NSE:TECHM to the text. The indicator will instantly recalculate the sector based on your new list.
✅4. Adjusting Inputs for Your Time Horizon
The logic is simple:
Lower Numbers: Make the indicator faster and more sensitive. It reacts quickly to price jumps but creates more "noise" (false signals).
Higher Numbers: Make the indicator slower and smoother. It filters out small corrections but reacts late to new trends.
Short-Term (Intraday / Fast Swing)
Recommended Inputs: Strength 10 | Momentum 3
Why: You need speed. By lowering the Strength to 10 days and Momentum to 3 days, the RRG will react instantly to sudden bursts of buying.
Best For: Catching "Micro-Rotations" (e.g., a sector suddenly waking up for a 2-3 day rally).
Trade-off: You will see sectors jump between "Leading" and "Weakening" very frequently.
Medium-Term (Standard Swing Trading)
Recommended Inputs: Strength 20 | Momentum 5 (Default)
Why: This is the "Goldilocks" zone. It ignores the daily noise but is fast enough to catch a trend that lasts for a few weeks.
Best For: Identifying the main theme of the current month.
Trade-off: Balanced. It might be slightly too slow for scalpers and slightly too fast for multi-year investors.
Long-Term (Position Investing)
Recommended Inputs: Strength 60 | Momentum 15
Why: A strength lookback of 60 (approx. 1 quarter) ensures you are only looking at major structural trends. A momentum of 15 ensures that a 2-day drop doesn't scare you out of a "Leading" sector.
Best For: Building a portfolio to hold for 6–12 months. If a sector is "Leading" here, it is in a massive bull run.
Trade-off: Very slow. By the time a sector turns "Leading," the trend has already been established for a while.
✅5. The "Secret" Tooltip Feature
Don't forget to hover your mouse cursor over the RRG Status text in the table (e.g., over the word "Leading").
A detailed box will appear showing:
Math: Exact Strength and Momentum scores.
Strategy: A text advice (e.g., "Trend is strong. Look for breakouts").
Constituents: The exact list of stocks used to calculate that sector's performance. This saves you from having to guess which stocks belong to that group.
Catatan Rilis
This update introduces powerful trend filtering and volatility metrics to help you better qualify sector rotation setups.1. New Feature: Market Stage Analysis I have added a "Stage (150D)" column based on the classic Weinstein Stage Analysis method. This helps identify whether a sector is in a long-term uptrend, downtrend, or consolidation.
Logic: It uses a 150-Day Weighted Moving Average (WMA) (roughly equivalent to the 30-Week MA) and compares it against the current price and the slope of the MA itself.
Stage 2 (Markup): Price > WMA & WMA is Rising (Green).
Stage 4 (Markdown): Price < WMA & WMA is Falling (Red).
Stage 1 & 3: Consolidation/Transition phases (Yellow/Orange).
"New Index" Label: You may see a grey "New Index" label. This appears when a sector or index has less than 150 days of trading history. Since a 150-day average cannot be mathematically calculated without 150 days of data, the script automatically flags these as "New" rather than showing an error.
2. New Metrics: 52-Week High/Low Distance New optional columns "Away 52WH" and "Away 52WL" display the percentage distance between the current price and the 52-week extremes.
Usage: Sort by these columns to find sectors breaking out (near 0% Away 52WH) or sectors that are deeply oversold (near 0% Away 52WL).
Smart Calculation (Dynamic History): Standard indicators often break on recent IPOs or new indices because they look back exactly 252 trading days. This script uses a dynamic lookback:
Old Indices: Looks back the standard 252 days.
New Indices: If an index is only 50 days old, the script detects this and automatically calculates the High/Low based on the available 50 days. This ensures you always see valid data, effectively showing the "All-Time High/Low" for new listings.
3. Flexible Benchmark Selection: The RRG Benchmark input has been upgraded from a fixed dropdown list to a Symbol Search. You can now compare sector strength against any ticker (e.g., NIFTY500, Gold, USDINR, or US Markets).
Skrip terproteksi
Skrip ini diterbitkan sebagai sumber tertutup. Namun, Anda dapat menggunakannya dengan bebas dan tanpa batasan apa pun – pelajari lebih lanjut di sini.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip terproteksi
Skrip ini diterbitkan sebagai sumber tertutup. Namun, Anda dapat menggunakannya dengan bebas dan tanpa batasan apa pun – pelajari lebih lanjut di sini.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.