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