PROTECTED SOURCE SCRIPT

Custom Sector Relative Strength (sector rotation)

66
📌 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.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.