OPEN-SOURCE SCRIPT

Yelober - Sector Rotation Detector

79
# Yelober - Sector Rotation Detector: User Guide

## Overview
The Yelober - Sector Rotation Detector is a TradingView indicator designed to track sector performance and identify market rotations in real-time. It monitors key sector ETFs, calculates performance metrics, and provides actionable stock recommendations based on sector strength and weakness.

## Purpose
This indicator helps traders identify when capital is moving from one sector to another (sector rotation), which can provide valuable trading opportunities. It also detects risk-off conditions in the market and highlights sectors with abnormal trading volume.

## Table Columns Explained

### 1. Sector
Displays the sector name being monitored. The indicator tracks six primary sectors plus the S&P 500:
- Energy (XLE)
- Financial (XLF)
- Technology (XLK)
- Consumer Staples (XLP)
- Utilities (XLU)
- Consumer Discretionary (XLY)
- S&P 500 (SPY)

### 2. Perf %
Shows the daily percentage performance of each sector ETF. Values are color-coded:
- Green: Positive performance
- Red: Negative performance
Positive values display with a "+" sign (e.g., +1.25%)

### 3. RSI
Displays the Relative Strength Index value for each sector, which helps identify overbought or oversold conditions:
- Values above 70 (highlighted in red): Potentially overbought
- Values below 30 (highlighted in green): Potentially oversold
- Values between 30-70 (highlighted in blue): Neutral territory

### 4. Vol Ratio
Shows the volume ratio, which compares today's volume to the average volume over the lookback period:
- Values above 1.5x (highlighted in yellow): Indicates abnormally high trading volume
- Values below 1.5x (highlighted in blue): Normal trading volume
This helps identify sectors with unusual activity that may signal important price movements.

### 5. Trend
Displays the current price trend direction with symbols:
- ▲ (green): Uptrend (today's close > yesterday's close)
- ▼ (red): Downtrend (today's close < yesterday's close)
- ◆ (gray): Neutral (today's close = yesterday's close)

## Summary & Recommendations Section

The summary section provides:

1. **Sector Rotation Detection**: Identifies when there's a significant performance gap (>2%) between the strongest and weakest sectors.

2. **Risk-Off Mode Detection**: Alerts when defensive sectors (Consumer Staples and Utilities) are positive while Technology is negative, which often signals investors are moving to safer assets.

3. **Strong Volume Detection**: Indicates when any sector shows abnormally high trading volume.

4. **Stock Recommendations**: Suggests specific stocks to consider for long positions (from the strongest sectors) and short positions (from the weakest sectors).

## Example Interpretations

### Example 1: Sector Rotation
If you see:
- Technology: -1.85%
- Financial: +2.10%
- Summary shows: "SECTOR ROTATION DETECTED: Rotation from Technology to Financial"

**Interpretation**: Capital is moving out of tech stocks and into financial stocks. This could be due to rising interest rates, which typically benefit banks while pressuring high-growth tech companies. Consider looking at financial stocks like JPM, BAC, and WFC for potential long positions.

### Example 2: Risk-Off Conditions
If you see:
- Consumer Staples: +0.80%
- Utilities: +1.20%
- Technology: -1.50%
- Summary shows: "RISK-OFF MODE DETECTED"

**Interpretation**: Investors are seeking safety in defensive sectors while selling growth-oriented tech stocks. This often occurs during market uncertainty or ahead of economic concerns. Consider reducing exposure to high-beta stocks and possibly adding defensive names like PG, KO, or NEE.

### Example 3: Volume Spike
If you see:
- Energy: +3.20% with Volume Ratio 2.5x (highlighted in yellow)
- Summary shows: "STRONG VOLUME DETECTED"

**Interpretation**: The energy sector is making a strong move with significantly higher-than-average volume, suggesting conviction behind the price movement. This could indicate the beginning of a sustained trend in energy stocks. Consider names like XOM, CVX, and COP.

## How to Use the Indicator

1. Apply the indicator to any chart (works best on daily timeframes).
2. Customize settings if needed:
- Timeframe: Choose between intraday (60 or 240 minutes), daily, or weekly
- Lookback Period: Adjust the historical comparison period (default: 20)
- RSI Period: Modify the RSI calculation period (default: 14)

3. To refresh the data: Click the settings icon, increase the "Click + to refresh data" counter, and click "OK".

4. Identify opportunities based on sector performance, RSI levels, volume ratios, and the summary recommendations.

This indicator helps traders align with market rotation trends and identify which sectors (and specific stocks) may outperform or underperform in the near term.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.