OPEN-SOURCE SCRIPT
Telah dikemas kini BTC vs GOLD Macro Rotation

BTC vs GOLD Macro Rotation Indicator
BTC vs GOLD Macro Rotation Model
This indicator is a macroeconomic rotation model that compares the relative attractiveness of Bitcoin (BTC) versus Gold (GOLD) based on multiple fundamental macro factors.
How does it work?
The model analyzes weekly data from various macroeconomic indicators and generates a score for each asset. The taller bar indicates the preferred asset to rotate capital into.
- Green bars (above zero): BTC strength
- Yellow bars (below zero):GOLD strength
- Info table:Shows exact percentages and rotation recommendation
Macroeconomic Factors Analyzed:
1. DXY (US Dollar Index)
- Strong dollar → Favors GOLD
- Weak dollar → Favors BTC
2. Oil (WTI Crude)
- Oil rising → Favors GOLD
- Oil falling → Favors BTC
3. Copper
- Copper rising → Favors BTC (risk-on)
- Copper falling → Favors GOLD (risk-off)
4. Real Rates (Fed Funds - YoY Inflation)
- Real rates falling → Favors GOLD
- Real rates rising → Favors BTC
5. Fertilizer/Natural Gas Regime (Urea, Ammonia, Natural Gas)**
- Specific combinations of movements in these commodities generate inflationary/deflationary regime signals
Fertilizer Rules:**
| Urea | Ammonia | Gas | Signal |
|------|---------|-----|--------|
| ↑ | ↑ | ↓ | GOLD +2 |
| ↑ | ↑ | ↑ | GOLD +3, BTC -1 |
| ↓ | ↓ | ↓ | BTC +3, GOLD -1 |
| ↑ | ↓ | ↓ | BTC +3 |
| ↓ | ↑ | ↑ | GOLD +3, BTC -1 |
Technical Features:
- Operates on weekly timeframe regardless of chart
- Normalized changes for signal stability
- Configurable EMA smoothing
- Safe handling of invalid symbols (won't break if a ticker doesn't exist)
- All tickers are user-editable
Configurable Inputs:
- Symbols for all assets (BTC, GOLD, DXY, Oil, Copper, CPI, Fed Funds, Gas, Urea, Ammonia)
- Individual weights for each macro component
- Normalization length
- EMA smoothing
Interpretation:**
- **BTC dominant (taller green):** Macro conditions favor risk/digital assets
- **GOLD dominant (taller yellow):** Macro conditions favor safe-haven/tangible assets
This indicator is for educational and informational purposes only. It does not constitute financial advice. Always do your own research before making investment decisions.
Recommended Timeframe: Weekly (W) or Daily (D)
BTC vs GOLD Macro Rotation Model
This indicator is a macroeconomic rotation model that compares the relative attractiveness of Bitcoin (BTC) versus Gold (GOLD) based on multiple fundamental macro factors.
How does it work?
The model analyzes weekly data from various macroeconomic indicators and generates a score for each asset. The taller bar indicates the preferred asset to rotate capital into.
- Green bars (above zero): BTC strength
- Yellow bars (below zero):GOLD strength
- Info table:Shows exact percentages and rotation recommendation
Macroeconomic Factors Analyzed:
1. DXY (US Dollar Index)
- Strong dollar → Favors GOLD
- Weak dollar → Favors BTC
2. Oil (WTI Crude)
- Oil rising → Favors GOLD
- Oil falling → Favors BTC
3. Copper
- Copper rising → Favors BTC (risk-on)
- Copper falling → Favors GOLD (risk-off)
4. Real Rates (Fed Funds - YoY Inflation)
- Real rates falling → Favors GOLD
- Real rates rising → Favors BTC
5. Fertilizer/Natural Gas Regime (Urea, Ammonia, Natural Gas)**
- Specific combinations of movements in these commodities generate inflationary/deflationary regime signals
Fertilizer Rules:**
| Urea | Ammonia | Gas | Signal |
|------|---------|-----|--------|
| ↑ | ↑ | ↓ | GOLD +2 |
| ↑ | ↑ | ↑ | GOLD +3, BTC -1 |
| ↓ | ↓ | ↓ | BTC +3, GOLD -1 |
| ↑ | ↓ | ↓ | BTC +3 |
| ↓ | ↑ | ↑ | GOLD +3, BTC -1 |
Technical Features:
- Operates on weekly timeframe regardless of chart
- Normalized changes for signal stability
- Configurable EMA smoothing
- Safe handling of invalid symbols (won't break if a ticker doesn't exist)
- All tickers are user-editable
Configurable Inputs:
- Symbols for all assets (BTC, GOLD, DXY, Oil, Copper, CPI, Fed Funds, Gas, Urea, Ammonia)
- Individual weights for each macro component
- Normalization length
- EMA smoothing
Interpretation:**
- **BTC dominant (taller green):** Macro conditions favor risk/digital assets
- **GOLD dominant (taller yellow):** Macro conditions favor safe-haven/tangible assets
This indicator is for educational and informational purposes only. It does not constitute financial advice. Always do your own research before making investment decisions.
Recommended Timeframe: Weekly (W) or Daily (D)
Nota Keluaran
## BTC vs GOLD Macro Rotation Indicator### Description for TradingView:
---
BTC vs GOLD Macro Rotation Model
This indicator is a macroeconomic rotation model that compares the relative attractiveness of Bitcoin (BTC) versus Gold (GOLD) based on multiple fundamental macro factors and real performance data.
How does it work?
The model analyzes weekly data from various macroeconomic indicators and generates a strength score for each asset. The taller bar indicates the preferred asset to rotate capital into. Additionally, the model includes a Relative Performance Override (RPO) that ensures recommendations align with actual market performance.
Visual Output:
- Green bars (above zero): BTC strength
- Yellow bars (below zero): GOLD strength
- Info table: Shows strength values, RPO status, and recent returns
Macroeconomic Factors Analyzed:
1. DXY (US Dollar Index)
- Strong dollar favors GOLD
- Weak dollar favors BTC
2. Oil (WTI Crude)
- Oil rising favors GOLD (inflation pressure)
- Oil falling favors BTC
3. Copper
- Copper rising favors BTC (risk-on, growth)
- Copper falling favors GOLD (risk-off)
4. Real Rates (Nominal Rate minus YoY Inflation)
- Real rates falling favors GOLD
- Real rates rising favors BTC
5. Fertilizer and Natural Gas Regime (Urea, Ammonia, Natural Gas)
- Specific combinations of movements in these commodities generate inflationary or deflationary regime signals
Fertilizer Rules:
Urea Up + Ammonia Up + Gas Down = GOLD +2
Urea Up + Ammonia Up + Gas Up = GOLD +3, BTC -1
Urea Down + Ammonia Down + Gas Down = BTC +3, GOLD -1
Urea Up + Ammonia Down + Gas Down = BTC +1.5
Urea Down + Ammonia Up + Gas Up = GOLD +2, BTC -0.5
Urea Down + Ammonia Up + Gas Down = GOLD +1
Key Features:
Relative Performance Override (RPO)
The RPO compares actual N-week returns of BTC vs GOLD. If one asset is clearly outperforming the other by more than the threshold (default 1%), the model overrides the macro score to favor the winning asset. This prevents recommending BTC when GOLD is rallying, and vice versa.
Adaptive Weights
When enabled, the model reduces fertilizer weight by 50% if urea and ammonia signals diverge (one up, one down). It also scales conviction down proportionally when multiple data sources are unavailable.
Confidence Scaling
The model tracks how many macro factors have valid data. If some symbols are unavailable, overall conviction is reduced proportionally to reflect lower certainty.
Technical Features:
- Operates on weekly timeframe regardless of chart
- Normalized changes clamped to prevent outliers from dominating
- Configurable EMA smoothing
- Safe handling of invalid symbols (graceful degradation if a ticker does not exist)
- All tickers are user-editable
Configurable Inputs:
Symbols: BTC, GOLD, DXY, Oil, Copper, CPI, Interest Rate, Natural Gas, Urea, Ammonia
Weights: Individual weights for each macro component (Fertilizer, DXY, Oil, Copper, Real Rate)
RPO Settings: Enable/disable RPO, lookback period (weeks), threshold percentage, boost points
Adaptive Settings: Enable/disable adaptive weights
General: Normalization length, EMA smoothing length
Interpretation:
- BTC dominant (taller green bar): Macro conditions and/or recent performance favor risk assets and digital stores of value
- GOLD dominant (taller yellow bar): Macro conditions and/or recent performance favor safe-haven tangible assets
- RPO Status in table shows which asset has momentum advantage
Disclaimer:
This indicator is for educational and informational purposes only. It does not constitute financial advice. Always do your own research before making investment decisions. Past performance does not guarantee future results.
---
Suggested Tags: btc gold macro rotation dxy inflation rates commodities bitcoin xauusd rpo momentum
Category: Indicators
Recommended Timeframe: Weekly (W) or Daily (D)
Nota Keluaran
## BTC vs GOLD Macro Rotation IndicatorDescription
A macro-driven rotation model that signals whether to favor Bitcoin or Gold based on real-time economic conditions.
This indicator analyzes multiple macroeconomic factors to determine the relative attractiveness of BTC versus GOLD as investment assets. It combines fertilizer market dynamics, currency strength, commodity prices, and real interest rates into a unified scoring system.
---
How It Works
The model evaluates 5 key macro factors on a weekly timeframe:
1. Fertilizer Regime (Urea, Ammonia, Natural Gas)
Rising fertilizer costs with falling gas indicates inflationary pressure and favors GOLD. Falling fertilizer costs with falling gas suggests a deflationary or stable environment and favors BTC. When urea and ammonia signals diverge, the model automatically reduces the weight of this factor.
2. US Dollar Index (DXY)
DXY rising indicates dollar strength and favors GOLD as a safe haven. DXY falling indicates dollar weakness and favors BTC as a risk-on asset.
3. Oil (WTI Crude)
Oil rising increases inflation hedge demand and favors GOLD. Oil falling suggests improved risk appetite and slightly favors BTC.
4. Copper
Copper rising signals economic growth expectations and favors BTC. Copper falling indicates slowdown fears and favors GOLD.
5. Real Interest Rates (Fed Funds Rate minus CPI YoY)
Real rates falling into negative territory favors GOLD. Real rates rising into positive territory favors BTC.
---
Relative Performance Override (RPO)
The indicator includes a reality-check mechanism that prevents the macro model from contradicting actual market performance. It calculates 4-week returns for both BTC and GOLD. If one asset significantly outperforms the other by more than 1 percent, the model boosts the winner's strength score. This prevents scenarios where the indicator recommends BTC while GOLD is clearly outperforming in practice.
---
Visual Interpretation
Green bars extending upward represent BTC strength score. Yellow bars extending downward represent GOLD strength score. The taller bar indicates the recommended asset. Background tint shows green when BTC is favored and yellow when GOLD is favored. The info table in the top right corner displays exact scores, RPO status, and 4-week returns for both assets.
---
Key Features
Timeframe Independent: Always uses weekly data regardless of chart timeframe, ensuring consistent signals across all charts.
Adaptive Weights: Automatically reduces fertilizer signal weight when urea and ammonia show divergent behavior.
Confidence Scaling: Adjusts conviction based on data availability from all sources.
Safe Symbol Handling: Gracefully handles missing or invalid data sources without breaking.
Fully Customizable: All symbols and weights are user-configurable through the settings panel.
---
Configurable Inputs
Symbols: BTC, GOLD, DXY, Oil, Copper, CPI, Interest Rate, Natural Gas, Urea, Ammonia
Weights: Adjust the importance of each macro factor from 0 to 5
RPO Settings: Enable or disable RPO, set lookback period in weeks, adjust outperformance threshold percentage, and configure strength boost amount
---
Best Use Cases
Portfolio rotation between crypto and precious metals. Macro regime identification for position sizing. Confirmation tool alongside technical analysis. Risk management signal for crypto exposure.
---
Disclaimer
This indicator is for educational and informational purposes only. It does not constitute financial advice. Past performance does not guarantee future results. Always conduct your own research and consider your risk tolerance before making investment decisions.
Recommended Timeframe: Daily or Weekly charts
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.