OPEN-SOURCE SCRIPT
Sector Rotation & Allocation Strategy

Sector Rotation & Allocation Strategy
Overview
What It Does
How It Works
Market Regime Detection The indicator compares Defensive Sectors (Health Care, Consumer Staples, Utilities) against Cyclical Sectors (Technology, Financials, Energy, Industrials, Materials, Real Estate, Discretionary, Communication).
Risk-On Market (Green, >0):
Risk-Off Market (Red, <0):
Understanding the Four Tables
1. MARKET REGIME (Top Left)
2. SECTOR RANKINGS (Top Right) Shows relative strength of all 11 sectors vs SPY benchmark.
3. ALLOCATION RECOMMENDATIONS (Bottom Center) Suggested portfolio allocation between Defensive and Cyclical sectors.
4. ASSET ANALYSIS (Bottom Left)
Trading Signals Explained
BUY Signals
SELL Signals
How Value Score Works (0-100)
Relative Strength (40 points max):
Sector Alignment (30 points max):
Momentum (30 points max):
Interpretation:
Best Practices
Disclaimer This indicator is for educational and informational purposes only. Past performance does not guarantee future results. Conduct your own research before making investment decisions.
Version: 6.0 Author: bigcitytom Last Updated: February 2026
Overview
- This advanced indicator analyzes the relationship between Defensive and Cyclical sectors to identify market regimes and generate precise buy/sell signals. It automatically detects which asset you're viewing and provides tailored recommendations based on current sector rotation dynamics.
What It Does
- Identifies Market Regime – Determines if markets are in Risk-On (growth) or Risk-Off (defensive) mode Auto-Detects Your Asset – Classifies the current chart into one of 11 sectors Generates Trading Signals – Provides BUY/SELL signals based on sector alignment with market conditions Multi-Timeframe Analysis – Offers allocation recommendations from 1 week to 12 months
- Value Assessment – Scores each asset 0-100 to determine if it's a good trade NOW
How It Works
Market Regime Detection The indicator compares Defensive Sectors (Health Care, Consumer Staples, Utilities) against Cyclical Sectors (Technology, Financials, Energy, Industrials, Materials, Real Estate, Discretionary, Communication).
Risk-On Market (Green, >0):
- Cyclical sectors outperformingEconomic growth expectedInvestors favoring growth stocksAction: Buy cyclicals, reduce defensives
Risk-Off Market (Red, <0):
- Defensive sectors outperformingUncertainty or fear in marketsFlight to safety occurringAction: Buy defensives, reduce cyclicals
Understanding the Four Tables
1. MARKET REGIME (Top Left)
- Market Regime: Current state – RISK-ON or RISK-OFF Bias: Which sector type is favored right now Strength: STRONG/MODERATE/WEAK – conviction level Current Sector: Your asset's sector classification
- Signal: Trading recommendation for your specific asset
2. SECTOR RANKINGS (Top Right) Shows relative strength of all 11 sectors vs SPY benchmark.
- Rel Str: Percentage outperformance/underperformance vs market Signal: ✓ = Outperforming, ✗ = Underperforming, − = Neutral
3. ALLOCATION RECOMMENDATIONS (Bottom Center) Suggested portfolio allocation between Defensive and Cyclical sectors.
- 1 Week: Tactical – follows current regime closely (70/30 split) 1 Month: Near-term positioning (65/35 split) 3 Months: Medium-term allocation (60/40 split) 6 Months: Balanced approach (50/50 split)
- 12 Months: Strategic/Contrarian – assumes mean reversion (40/60 split)
4. ASSET ANALYSIS (Bottom Left)
- Sector: Auto-detected sector classification Value Rating: STRONG BUY / BUY / HOLD / REDUCE / AVOID Value Score: 0-100 numerical assessment Rel Strength: How this asset performs vs SPY
- Regime Fit: Is this asset aligned with current market regime?
Trading Signals Explained
BUY Signals
- Oscillator crosses above oversold (30)Asset's sector is gaining momentum
- Regime is favorable for that sector
SELL Signals
- Oscillator crosses below overbought (70)Asset's sector is losing momentum
- Regime is turning unfavorable for that sector
How Value Score Works (0-100)
Relative Strength (40 points max):
- Asset outperforming SPY by 5%+ → 40 pointsAsset outperforming SPY by 2-5% → 30 pointsAsset outperforming SPY by 0-2% → 20 pointsAsset underperforming slightly → 10 points
- Asset underperforming significantly → 0 points
Sector Alignment (30 points max):
- Defensive in Risk-Off OR Cyclical in Risk-On → 30 pointsMisaligned sector → 0 points
- Unclassified → 15 points
Momentum (30 points max):
- RSI > 60 → 30 pointsRSI 50-60 → 20 pointsRSI 40-50 → 10 pointsRSI < 40 → 0 points
Interpretation:
- 80-100: STRONG BUY – High conviction opportunity 65-79: BUY – Favorable setup 45-64: HOLD – No clear edge 30-44: REDUCE – Unfavorable conditions
- 0-29: AVOID – High risk of underperformance
Best Practices
- Use Daily Timeframe or Higher – More reliable signals Combine with Price Action – Confirm with support/resistance Monitor Regime Changes – Transitions offer the highest ROI Respect Risk Management – Always use stop losses
- Don't Fight the Regime – Buying defensives during Risk-On is low probability
Disclaimer This indicator is for educational and informational purposes only. Past performance does not guarantee future results. Conduct your own research before making investment decisions.
Version: 6.0 Author: bigcitytom Last Updated: February 2026
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。