OPEN-SOURCE SCRIPT
Bitcoin vs. S&P 500 Performance Comparison

**Full Description:**
**Overview**
This indicator provides an intuitive visual comparison of Bitcoin's performance versus the S&P 500 by shading the chart background based on relative strength over a rolling lookback period.
**How It Works**
- Calculates percentage returns for both Bitcoin and the S&P 500 (ES1! futures) over a specified lookback period (default: 75 bars)
- Compares the returns and shades the background accordingly:
- **Green/Teal Background**: Bitcoin is outperforming the S&P 500
- **Red/Maroon Background**: S&P 500 is outperforming Bitcoin
- Displays a real-time performance difference label showing the exact percentage spread
**Key Features**
✓ Rolling performance comparison using customizable lookback period (default 75 bars)
✓ Clean visual representation with adjustable transparency
✓ Works on any timeframe (optimized for daily charts)
✓ Real-time performance differential display
✓ Uses ES1! (E-mini S&P 500 continuous futures) for accurate comparison
✓ Fine-tuning adjustment factor for precise calibration
**Use Cases**
- Identify market regimes where Bitcoin outperforms or underperforms traditional equities
- Spot trend changes in relative performance
- Assess risk-on vs risk-off periods
- Compare Bitcoin's momentum against broader market conditions
- Time entries/exits based on relative strength shifts
**Settings**
- **S&P 500 Symbol**: Default ES1! (can be changed to SPX or other indices)
- **Lookback Period**: Number of bars for performance calculation (default: 75)
- **Adjustment Factor**: Fine-tune calibration to match specific data feeds
- **Transparency Controls**: Customize background shading intensity
- **Show/Hide Label**: Toggle performance difference display
**Best Practices**
- Use on daily timeframe for swing trading and position analysis
- Combine with other momentum indicators for confirmation
- Watch for color transitions as potential regime change signals
- Consider using multiple timeframes for comprehensive analysis
**Technical Details**
The indicator calculates rolling percentage returns using the formula: ((Current Price / Price[Lookback]) - 1) × 100, then compares Bitcoin's return to the S&P 500's return over the same period. The background color dynamically updates based on which asset is showing stronger performance.
**Overview**
This indicator provides an intuitive visual comparison of Bitcoin's performance versus the S&P 500 by shading the chart background based on relative strength over a rolling lookback period.
**How It Works**
- Calculates percentage returns for both Bitcoin and the S&P 500 (ES1! futures) over a specified lookback period (default: 75 bars)
- Compares the returns and shades the background accordingly:
- **Green/Teal Background**: Bitcoin is outperforming the S&P 500
- **Red/Maroon Background**: S&P 500 is outperforming Bitcoin
- Displays a real-time performance difference label showing the exact percentage spread
**Key Features**
✓ Rolling performance comparison using customizable lookback period (default 75 bars)
✓ Clean visual representation with adjustable transparency
✓ Works on any timeframe (optimized for daily charts)
✓ Real-time performance differential display
✓ Uses ES1! (E-mini S&P 500 continuous futures) for accurate comparison
✓ Fine-tuning adjustment factor for precise calibration
**Use Cases**
- Identify market regimes where Bitcoin outperforms or underperforms traditional equities
- Spot trend changes in relative performance
- Assess risk-on vs risk-off periods
- Compare Bitcoin's momentum against broader market conditions
- Time entries/exits based on relative strength shifts
**Settings**
- **S&P 500 Symbol**: Default ES1! (can be changed to SPX or other indices)
- **Lookback Period**: Number of bars for performance calculation (default: 75)
- **Adjustment Factor**: Fine-tune calibration to match specific data feeds
- **Transparency Controls**: Customize background shading intensity
- **Show/Hide Label**: Toggle performance difference display
**Best Practices**
- Use on daily timeframe for swing trading and position analysis
- Combine with other momentum indicators for confirmation
- Watch for color transitions as potential regime change signals
- Consider using multiple timeframes for comprehensive analysis
**Technical Details**
The indicator calculates rolling percentage returns using the formula: ((Current Price / Price[Lookback]) - 1) × 100, then compares Bitcoin's return to the S&P 500's return over the same period. The background color dynamically updates based on which asset is showing stronger performance.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.