PROTECTED SOURCE SCRIPT
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.
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.