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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.