OPEN-SOURCE SCRIPT
Capital Rotational Event CRE As A Multi Pair Scanner

Capital Rotational Event (CRE) – Multi Pair Rotation Scanner
This open-source, non-overlay indicator scans for **capital rotation signals** across one lead/benchmark asset and up to four receiver/target assets simultaneously.
It detects when capital appears to be rotating **into** one or more of the receiver assets relative to the lead asset — a classic macro/rotation concept used in intermarket analysis.
Core Concept
In regime-shifting or macro-driven markets, money flows between asset classes or correlated instruments (risk-on → risk-off, equities → bonds, growth → value, etc.). When one asset class starts consistently outperforming another — and that outperformance is accelerating — it can signal a change in investor preference, risk appetite, or sector leadership.
This scanner visualizes that rotation in real time by calculating relative strength + momentum for multiple pairs at once.
How It Works
1. User selects:
- One Lead/ Benchmark asset (default: SPY – equities proxy)
- Up to four Receiver assets (defaults: GLD, TLT, USO, XLE)
2. For each receiver pair:
- Relative Strength (RS) = SMA( Receiver Close / Lead Close , RS Length )
- RS Momentum = SMA( change(RS) , Momentum Length )
3. Rotation Signal per pair:
- Bullish CRE (+1): RS > its own SMA **and** RS momentum > 0
→ Receiver outperforming Lead **and** the outperformance is accelerating
- Bearish CRE (-1): RS < its own SMA **and** RS momentum < 0
→ Receiver underperforming Lead **and** the underperformance is accelerating
- Neutral (0): otherwise
4. Visual Output:
- Four separate lines (green, blue, orange, purple) showing CRE signal for each receiver
→ +1 = bullish rotation into that asset
→ -1 = bearish rotation away from that asset
→ 0 = no clear rotation
- Background tint: light green when **at least one** receiver shows bullish CRE (+1)
Why this multi-pair scanner?
- Single-pair RS tools only show one relationship at a time.
- Monitoring multiple receivers simultaneously reveals **which** asset class or sector is currently receiving capital flows — very useful for macro traders, sector rotation strategies, or risk-on/off positioning.
- The momentum filter reduces lag and false signals compared to raw RS crossovers alone.
Typical Use Cases
- Risk-on/Risk-off: SPY (lead) vs GLD + TLT + USO (safe havens/commodities)
- Sector leadership: SPY vs XLE (energy) + XLK (tech) + XLV (healthcare) + XLF (financials)
- Macro themes: SPY vs TLT (equities vs bonds), DXY vs GLD, etc.
- Timeframes: Daily/weekly for macro swings, 4h/1h for tactical rotations
How to Use
1. Apply to any chart (timeframe of your choice — the indicator is timeframe-agnostic).
2. Set your preferred Lead asset and up to 4 Receivers in the inputs.
3. Adjust RS Length (default 14) and Momentum Length (default 9) to match your horizon.
4. Interpretation:
- Green line above zero → capital rotating into that receiver
- Multiple green lines rising → strong multi-sector rotation
- Light green background → at least one bullish rotation detected
- Use in combination with price action on the actual assets — this is a relative bias tool, not a direct trade signal.
5. Best in trending or regime-shifting markets; less useful when all assets move in strong correlation.
Inputs
- Lead Asset: benchmark (default SPY)
- Receiver 1–4: assets to monitor rotation into (defaults GLD, TLT, USO, XLE)
- RS Length: smoothing for relative strength (default 14)
- Momentum Length: smoothing for RS change (default 9)
Publishing Recommendation
- Publish with a clean chart (e.g., daily or 4h SPY, or any index/ETF)
- The indicator is non-overlay — it plots in a separate pane below price
- No other indicators needed for basic use
This script is fully open-source for transparency and learning. It highlights relative rotation patterns — not guaranteed future performance. Trading and investing involve significant risk of loss.
Feedback welcome — especially suggestions for other useful receiver pairs!
This open-source, non-overlay indicator scans for **capital rotation signals** across one lead/benchmark asset and up to four receiver/target assets simultaneously.
It detects when capital appears to be rotating **into** one or more of the receiver assets relative to the lead asset — a classic macro/rotation concept used in intermarket analysis.
Core Concept
In regime-shifting or macro-driven markets, money flows between asset classes or correlated instruments (risk-on → risk-off, equities → bonds, growth → value, etc.). When one asset class starts consistently outperforming another — and that outperformance is accelerating — it can signal a change in investor preference, risk appetite, or sector leadership.
This scanner visualizes that rotation in real time by calculating relative strength + momentum for multiple pairs at once.
How It Works
1. User selects:
- One Lead/ Benchmark asset (default: SPY – equities proxy)
- Up to four Receiver assets (defaults: GLD, TLT, USO, XLE)
2. For each receiver pair:
- Relative Strength (RS) = SMA( Receiver Close / Lead Close , RS Length )
- RS Momentum = SMA( change(RS) , Momentum Length )
3. Rotation Signal per pair:
- Bullish CRE (+1): RS > its own SMA **and** RS momentum > 0
→ Receiver outperforming Lead **and** the outperformance is accelerating
- Bearish CRE (-1): RS < its own SMA **and** RS momentum < 0
→ Receiver underperforming Lead **and** the underperformance is accelerating
- Neutral (0): otherwise
4. Visual Output:
- Four separate lines (green, blue, orange, purple) showing CRE signal for each receiver
→ +1 = bullish rotation into that asset
→ -1 = bearish rotation away from that asset
→ 0 = no clear rotation
- Background tint: light green when **at least one** receiver shows bullish CRE (+1)
Why this multi-pair scanner?
- Single-pair RS tools only show one relationship at a time.
- Monitoring multiple receivers simultaneously reveals **which** asset class or sector is currently receiving capital flows — very useful for macro traders, sector rotation strategies, or risk-on/off positioning.
- The momentum filter reduces lag and false signals compared to raw RS crossovers alone.
Typical Use Cases
- Risk-on/Risk-off: SPY (lead) vs GLD + TLT + USO (safe havens/commodities)
- Sector leadership: SPY vs XLE (energy) + XLK (tech) + XLV (healthcare) + XLF (financials)
- Macro themes: SPY vs TLT (equities vs bonds), DXY vs GLD, etc.
- Timeframes: Daily/weekly for macro swings, 4h/1h for tactical rotations
How to Use
1. Apply to any chart (timeframe of your choice — the indicator is timeframe-agnostic).
2. Set your preferred Lead asset and up to 4 Receivers in the inputs.
3. Adjust RS Length (default 14) and Momentum Length (default 9) to match your horizon.
4. Interpretation:
- Green line above zero → capital rotating into that receiver
- Multiple green lines rising → strong multi-sector rotation
- Light green background → at least one bullish rotation detected
- Use in combination with price action on the actual assets — this is a relative bias tool, not a direct trade signal.
5. Best in trending or regime-shifting markets; less useful when all assets move in strong correlation.
Inputs
- Lead Asset: benchmark (default SPY)
- Receiver 1–4: assets to monitor rotation into (defaults GLD, TLT, USO, XLE)
- RS Length: smoothing for relative strength (default 14)
- Momentum Length: smoothing for RS change (default 9)
Publishing Recommendation
- Publish with a clean chart (e.g., daily or 4h SPY, or any index/ETF)
- The indicator is non-overlay — it plots in a separate pane below price
- No other indicators needed for basic use
This script is fully open-source for transparency and learning. It highlights relative rotation patterns — not guaranteed future performance. Trading and investing involve significant risk of loss.
Feedback welcome — especially suggestions for other useful receiver pairs!
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.