PROTECTED SOURCE SCRIPT

Custom Sector Relative Strength (sector rotation)

68
๐Ÿ“Œ Indicator Summary for โ€œCustom Sector Relative Strength (sector rotation)โ€
๐Ÿ”น Overview:
This Pine Script indicator calculates and displays the relative strength performance of up to 25 customizable sectors or ETFs compared to a user-defined benchmark index (e.g., SPY, TASI.TAD, etc.).
It helps traders and analysts identify which sectors are outperforming or underperforming relative to the benchmark over different time frames.
________________________________________
๐Ÿ”น Calculation Method:
For each sector, the indicator:
1. Retrieves the current and past closing prices for both the sector and the benchmark.
2. Computes the ratio of the sector's price to the benchmark at both time points.
3. Calculates the percentage change in this ratio over the selected lookback period:
4. Relative Strength (%) = ((Current_Ratio / Past_Ratio) - 1) * 100
5. Assigns a direction symbol:
o โ†‘ for positive outperformance
o โ†“ for underperformance
o โ†’ for no significant change
6. Applies a color code for clarity:
o Green for โ†‘
o Red for โ†“
o Gray for โ†’
________________________________________
๐Ÿ”น How to Use:
1. Set your benchmark index (e.g., SPY or TASI.TAD) from the settings panel.
2. Choose a lookback period: 1 Day, 1 Week, 1 Month, 3 Months, 6 Months, or 1 Year.
3. Define up to 25 sectors:
o Enter the symbol and name of each sector.
o Toggle the Show option on/off to include/exclude any sector.
4. The script will sort the sectors from strongest to weakest based on their relative performance.
5. Results are displayed in a dynamic table on the chart showing:
o Ticker
o Sector Name
o Relative % Performance
o Direction Indicator (โ†‘ โ†“ โ†’)
________________________________________
๐Ÿ”น Practical Uses:
โ€ข Sector rotation strategies
โ€ข Market breadth analysis
โ€ข Benchmark-relative strength monitoring
โ€ข Multi-sector ETFs or custom group comparisons
โ€ข Saudi, US, or global sector analysis
________________________________________
Let me know if you'd like an Arabic version or want this formatted as a PDF or used as a code comment section.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.