OPEN-SOURCE SCRIPT
Spread Analysis

Spread Analysis - Futures vs Spot Price Analysis
Advanced spread analysis tool that compares futures/perp prices with spot prices across multiple exchanges, providing insights into market sentiment and potential trading opportunities.
Key Features:
• Automatic asset detection and appropriate spread calculation
• Configurable Z-score alerts for extreme conditions
• Comprehensive tooltips and information guide
• Multiple calculation methods (absolute, percentage, basis points)
• Clean, customizable visual display
Use Cases:
• Crypto traders analyzing perp vs spot relationships
• Futures traders monitoring basis relationships
• Mean reversion strategies using extreme spreads
• Trend confirmation using spread momentum
• Market sentiment analysis across asset classes
Advanced spread analysis tool that compares futures/perp prices with spot prices across multiple exchanges, providing insights into market sentiment and potential trading opportunities.
- Multi-Asset Support: Automatically detects and analyzes crypto perpetual vs spot spreads, index futures vs cash indices (ES/SPX, NQ/NDX, YM/DJI), and commodity futures vs spot prices (GC/GOLD, CL/USOIL)
- Multi-Exchange Aggregation: For crypto, aggregates prices from Binance, BitMEX, Kraken, Bybit, OKX, and Coinbase to calculate mean perp and spot prices
- Z-Score Based Alerts: Uses statistical Z-score analysis to identify extreme spread conditions that may signal potential reversals or continuation patterns
- Visual Histogram Display: Shows spread differences as colored columns - green for futures premium, red for futures discount
- Flexible Calculation Methods: Supports absolute price differences, percentage spreads, or basis point calculations
- Trading Applications: Identify market sentiment divergence, spot potential reversal opportunities, and confirm trend strength
- Risk Management: Use extreme Z-scores to identify overvalued conditions and potential mean reversion setups
- Market Analysis: Understand the relationship between futures and spot markets across different asset classes
- Timing Tool: Spread momentum often precedes price moves, providing early signals for entry/exit decisions
Perfect for traders who want to understand the relationship between futures and spot markets, identify divergences, and spot potential reversal opportunities across crypto, indices, and commodities.
Key Features:
• Automatic asset detection and appropriate spread calculation
• Configurable Z-score alerts for extreme conditions
• Comprehensive tooltips and information guide
• Multiple calculation methods (absolute, percentage, basis points)
• Clean, customizable visual display
Use Cases:
• Crypto traders analyzing perp vs spot relationships
• Futures traders monitoring basis relationships
• Mean reversion strategies using extreme spreads
• Trend confirmation using spread momentum
• Market sentiment analysis across asset classes
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.