OPEN-SOURCE SCRIPT
Spot-Futures Spread

Spot-Futures Spread Indicator
A comprehensive indicator that automatically calculates and visualizes the percentage spread between spot and perpetual futures prices across multiple exchanges.
Key Features:
How It Works:
The indicator calculates the spread as: (Futures Price - Spot Price) / Spot Price × 100
Use Cases:
Smart Features:
Perfect For:
Crypto traders monitoring funding rates, arbitrage traders, market makers, and anyone interested in spot-futures dynamics across multiple exchanges.
Getting Started:
Simply add the indicator to any spot or perpetual futures chart. It will automatically detect the exchange and find the corresponding pair. The statistics table shows which exchanges are being used for maximum transparency.
Note: The indicator automatically ignores invalid symbols, so you'll never see errors even if a specific pair doesn't exist on a particular exchange.[/I]
Kudos to AlekMel that made the "Spot - Fut Spread v2" indicator that I enhance the Automatic detection feature which was not working in some case.
A comprehensive indicator that automatically calculates and visualizes the percentage spread between spot and perpetual futures prices across multiple exchanges.
Key Features:
- Automatic Exchange Detection - Automatically detects your current exchange and finds the corresponding spot/futures pair
- Smart Fallback System - If the counterpart isn't available on your exchange, it automatically searches across 7+ major exchanges (Binance, Bybit, OKX, Gate.io, MEXC, KuCoin, HTX) and uses the first valid match
- Multi-Exchange Support - Works with 14 exchanges including Binance, Bybit, OKX, MEXC, BitGet, Gate.io, KuCoin, and more
- Clear Exchange Attribution - Shows exactly which exchanges are providing spot and futures data in the statistics table
- Configurable Moving Average - Track the average spread with customizable period
- Standard Deviation Bands - Identify unusual spread conditions with Bollinger-style bands
- Built-in Alerts - Get notified when spread crosses bands or zero (parity)
- Statistics Table - Real-time stats showing current spread, MA, std dev, and bands
- Manual Override Options - Advanced users can manually specify exchanges and symbols
How It Works:
The indicator calculates the spread as: (Futures Price - Spot Price) / Spot Price × 100
- Positive spread = Futures trading at a premium (contango)
- Negative spread = Futures trading at a discount (backwardation)
- Zero = Parity between spot and futures
Use Cases:
- Funding Rate Analysis - Correlates with perpetual funding rates
- Arbitrage Opportunities - Identify significant spot-futures divergences
- Market Sentiment - Premium/discount indicates bullish/bearish positioning
- Cross-Exchange Analysis - Compare spreads when spot and futures are on different exchanges
Smart Features:
- Works whether you're viewing a spot or futures chart
- Automatically handles exchange-specific perpetual contract naming (.P, PERP, SWAP, etc.)
- Color-coded visualization (green for premium, red for discount)
- Customizable colors and display options
- Background shading based on spread direction
Perfect For:
Crypto traders monitoring funding rates, arbitrage traders, market makers, and anyone interested in spot-futures dynamics across multiple exchanges.
Getting Started:
Simply add the indicator to any spot or perpetual futures chart. It will automatically detect the exchange and find the corresponding pair. The statistics table shows which exchanges are being used for maximum transparency.
Note: The indicator automatically ignores invalid symbols, so you'll never see errors even if a specific pair doesn't exist on a particular exchange.[/I]
Kudos to AlekMel that made the "Spot - Fut Spread v2" indicator that I enhance the Automatic detection feature which was not working in some case.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。