PROTECTED SOURCE SCRIPT
Spot-Futures Spread

The Spot-Futures Spread indicator measures the price difference between spot (cash) markets and futures markets for the same underlying asset. This spread reveals important information about market structure, sentiment, and potential arbitrage opportunities.
When futures trade above spot, this is called a futures premium. When futures trade below spot, this is called a futures discount. The size and direction of this spread provides insight into whether traders expect prices to rise or fall, how much it costs to carry the asset, and whether there are unusual supply or demand imbalances.
HOW IT WORKS
The indicator fetches price data from two different markets: a spot or cash market price and a futures contract price. For example, it might compare the spot gold price from a forex broker (XAUUSD) with the front month gold futures contract on COMEX (GC1!).
The core calculation is simple. Spread equals Futures Price minus Spot Price. A positive result means futures are trading at a premium to spot. A negative result means futures are trading at a discount to spot.
The indicator expresses this spread in multiple ways: as an absolute dollar value, as a percentage of the spot price, and as a statistical z-score showing how the current spread compares to historical norms.
DIFFERENCE FROM THE BASIS SUITE
https://www.tradingview.com/script/t3IgzY0U-Futures-Basis-Suite/
The Futures Basis Suite compares two futures contracts of different expiration months, such as the front month versus the second month. This shows the term structure or curve shape of the futures market.
The Spot-Futures Spread indicator compares the actual spot or cash market price to a futures contract. This shows the relationship between physical market pricing and derivatives market pricing.
Both indicators provide valuable but different information. The basis suite shows carrying costs and convenience yield within the futures market. The spot-futures spread shows how the derivatives market relates to the underlying physical or cash market.
FUTURES PREMIUM EXPLAINED
A futures premium means the futures price is higher than the spot price. This is the normal condition for most assets. The premium reflects several factors.
First, it includes the cost of carry. Holding a physical asset requires storage, insurance, and financing costs. Futures buyers avoid these costs, so they pay a premium reflecting what it would cost to hold the physical asset until delivery.
Second, it may reflect expectations of rising prices. If traders expect the asset price to increase, futures will trade at a premium to current spot.
Third, for financial assets like stock index futures, the premium reflects interest rates minus expected dividends. This is called the fair value premium.
FUTURES DISCOUNT EXPLAINED
A futures discount means the futures price is lower than the spot price. This is unusual for most assets and signals something important.
For commodities, a discount often indicates immediate physical scarcity. Buyers need the commodity now and are willing to pay more for immediate delivery than for future delivery.
For financial assets, a discount can indicate expected price declines, upcoming dividend payments, or market stress where futures are being sold heavily.
For cryptocurrencies, a discount often signals bearish sentiment as leveraged traders reduce long positions.
ANALYSIS MODES
Spread Absolute mode shows the raw dollar difference between futures and spot. This is useful for seeing the actual cost in currency terms.
Spread Percentage mode expresses the spread as a percentage of the spot price. This makes it easier to compare across different assets and time periods.
Z-Score mode normalizes the current spread against its historical distribution. A z-score of zero means the spread is at its historical average. Extreme z-scores indicate unusual conditions.
Premium/Discount mode labels the current regime and shows the spread percentage. This provides the clearest read on market conditions.
Raw Debug mode displays the underlying prices and calculation details for troubleshooting.
IMPORTANT SETTINGS
Symbol Mode determines how the indicator finds the spot and futures prices. Auto Detect reads your chart symbol and selects appropriate spot and futures sources. Dropdown lets you select from common assets. Manual lets you enter custom ticker symbols.
Spread Direction sets the calculation order. Futures minus Spot means positive values indicate premium. Spot minus Futures reverses this convention.
Premium Threshold and Discount Threshold set the percentage levels for classifying the spread as a premium, discount, or fair value.
Z-Score Length sets the lookback period for calculating how unusual the current spread is.
Arbitrage Threshold sets the percentage level at which the indicator flags potential arbitrage opportunities.
INTERPRETING THE SPREAD FOR DIFFERENT ASSETS
For precious metals like gold and silver, the spread reflects storage costs and financing costs. A larger than normal premium may indicate that physical is readily available. A narrowing premium or discount indicates physical tightness.
For crude oil, the spread reflects storage economics. When storage is cheap and plentiful, futures trade at premium. When storage is scarce or oil is in high demand, the spread narrows or inverts.
For stock index futures like the S&P 500, the spread reflects interest rates minus expected dividends. Deviations from fair value create arbitrage opportunities for institutional traders.
For cryptocurrencies, the spread reflects sentiment and funding conditions. Large premiums indicate bullish leverage. Discounts indicate bearish positioning or liquidation events.
ARBITRAGE OPPORTUNITIES
When the spot-futures spread deviates significantly from fair value, arbitrage opportunities may exist. Professional traders can exploit these by simultaneously buying the cheaper market and selling the more expensive market, locking in the spread as profit when prices converge.
The indicator alerts when spreads reach levels that historically indicate arbitrage opportunities. However, actual arbitrage requires accounting for transaction costs, execution risk, and margin requirements.
TRADING SIGNALS
Flip from Premium to Discount is often bearish. It indicates that near-term demand has collapsed or that leveraged longs are being liquidated.
Flip from Discount to Premium is often bullish. It indicates improving sentiment and increased demand for leveraged long exposure.
Extreme Z-Scores suggest the spread is unsustainable and likely to revert. This can indicate mean reversion trades or flag unusual market conditions requiring attention.
Expanding Spread during price rallies confirms that the move has broad participation from both spot and futures markets. Narrowing spread during rallies suggests futures traders are not confirming the move.
ALERTS
Regime Flip alerts trigger when the market crosses from premium to discount or vice versa.
Extreme Z-Score alerts trigger when the spread reaches statistical extremes.
Arbitrage Level alerts trigger when the spread exceeds the configured threshold, potentially indicating arbitrage opportunities.
SUPPORTED ASSETS
The indicator supports major assets across multiple classes. Precious metals include gold and silver comparing forex spot to COMEX futures. Energy includes crude oil comparing cash prices to NYMEX futures. Cryptocurrencies include Bitcoin and Ethereum comparing index prices to CME futures. Stock indices include S&P 500 and Nasdaq comparing cash indices to CME futures. Currencies include Euro and Yen comparing forex rates to CME futures.
LIMITATIONS
Spot and futures markets may have different trading hours, creating gaps in the spread calculation. Data quality varies between spot price sources. Transaction costs and execution risk affect whether theoretical arbitrage opportunities are practical. The indicator shows a single futures contract and does not capture the full term structure.
VERSION HISTORY
Version 1 released with five analysis modes, automatic symbol detection, comprehensive dashboard, regime classification, and arbitrage alerts.
CREDITS
Developed by Robinhodl21 as part of the Grandmaster Indicator Suite. Released under Mozilla Public License 2.0.
When futures trade above spot, this is called a futures premium. When futures trade below spot, this is called a futures discount. The size and direction of this spread provides insight into whether traders expect prices to rise or fall, how much it costs to carry the asset, and whether there are unusual supply or demand imbalances.
HOW IT WORKS
The indicator fetches price data from two different markets: a spot or cash market price and a futures contract price. For example, it might compare the spot gold price from a forex broker (XAUUSD) with the front month gold futures contract on COMEX (GC1!).
The core calculation is simple. Spread equals Futures Price minus Spot Price. A positive result means futures are trading at a premium to spot. A negative result means futures are trading at a discount to spot.
The indicator expresses this spread in multiple ways: as an absolute dollar value, as a percentage of the spot price, and as a statistical z-score showing how the current spread compares to historical norms.
DIFFERENCE FROM THE BASIS SUITE
https://www.tradingview.com/script/t3IgzY0U-Futures-Basis-Suite/
The Futures Basis Suite compares two futures contracts of different expiration months, such as the front month versus the second month. This shows the term structure or curve shape of the futures market.
The Spot-Futures Spread indicator compares the actual spot or cash market price to a futures contract. This shows the relationship between physical market pricing and derivatives market pricing.
Both indicators provide valuable but different information. The basis suite shows carrying costs and convenience yield within the futures market. The spot-futures spread shows how the derivatives market relates to the underlying physical or cash market.
FUTURES PREMIUM EXPLAINED
A futures premium means the futures price is higher than the spot price. This is the normal condition for most assets. The premium reflects several factors.
First, it includes the cost of carry. Holding a physical asset requires storage, insurance, and financing costs. Futures buyers avoid these costs, so they pay a premium reflecting what it would cost to hold the physical asset until delivery.
Second, it may reflect expectations of rising prices. If traders expect the asset price to increase, futures will trade at a premium to current spot.
Third, for financial assets like stock index futures, the premium reflects interest rates minus expected dividends. This is called the fair value premium.
FUTURES DISCOUNT EXPLAINED
A futures discount means the futures price is lower than the spot price. This is unusual for most assets and signals something important.
For commodities, a discount often indicates immediate physical scarcity. Buyers need the commodity now and are willing to pay more for immediate delivery than for future delivery.
For financial assets, a discount can indicate expected price declines, upcoming dividend payments, or market stress where futures are being sold heavily.
For cryptocurrencies, a discount often signals bearish sentiment as leveraged traders reduce long positions.
ANALYSIS MODES
Spread Absolute mode shows the raw dollar difference between futures and spot. This is useful for seeing the actual cost in currency terms.
Spread Percentage mode expresses the spread as a percentage of the spot price. This makes it easier to compare across different assets and time periods.
Z-Score mode normalizes the current spread against its historical distribution. A z-score of zero means the spread is at its historical average. Extreme z-scores indicate unusual conditions.
Premium/Discount mode labels the current regime and shows the spread percentage. This provides the clearest read on market conditions.
Raw Debug mode displays the underlying prices and calculation details for troubleshooting.
IMPORTANT SETTINGS
Symbol Mode determines how the indicator finds the spot and futures prices. Auto Detect reads your chart symbol and selects appropriate spot and futures sources. Dropdown lets you select from common assets. Manual lets you enter custom ticker symbols.
Spread Direction sets the calculation order. Futures minus Spot means positive values indicate premium. Spot minus Futures reverses this convention.
Premium Threshold and Discount Threshold set the percentage levels for classifying the spread as a premium, discount, or fair value.
Z-Score Length sets the lookback period for calculating how unusual the current spread is.
Arbitrage Threshold sets the percentage level at which the indicator flags potential arbitrage opportunities.
INTERPRETING THE SPREAD FOR DIFFERENT ASSETS
For precious metals like gold and silver, the spread reflects storage costs and financing costs. A larger than normal premium may indicate that physical is readily available. A narrowing premium or discount indicates physical tightness.
For crude oil, the spread reflects storage economics. When storage is cheap and plentiful, futures trade at premium. When storage is scarce or oil is in high demand, the spread narrows or inverts.
For stock index futures like the S&P 500, the spread reflects interest rates minus expected dividends. Deviations from fair value create arbitrage opportunities for institutional traders.
For cryptocurrencies, the spread reflects sentiment and funding conditions. Large premiums indicate bullish leverage. Discounts indicate bearish positioning or liquidation events.
ARBITRAGE OPPORTUNITIES
When the spot-futures spread deviates significantly from fair value, arbitrage opportunities may exist. Professional traders can exploit these by simultaneously buying the cheaper market and selling the more expensive market, locking in the spread as profit when prices converge.
The indicator alerts when spreads reach levels that historically indicate arbitrage opportunities. However, actual arbitrage requires accounting for transaction costs, execution risk, and margin requirements.
TRADING SIGNALS
Flip from Premium to Discount is often bearish. It indicates that near-term demand has collapsed or that leveraged longs are being liquidated.
Flip from Discount to Premium is often bullish. It indicates improving sentiment and increased demand for leveraged long exposure.
Extreme Z-Scores suggest the spread is unsustainable and likely to revert. This can indicate mean reversion trades or flag unusual market conditions requiring attention.
Expanding Spread during price rallies confirms that the move has broad participation from both spot and futures markets. Narrowing spread during rallies suggests futures traders are not confirming the move.
ALERTS
Regime Flip alerts trigger when the market crosses from premium to discount or vice versa.
Extreme Z-Score alerts trigger when the spread reaches statistical extremes.
Arbitrage Level alerts trigger when the spread exceeds the configured threshold, potentially indicating arbitrage opportunities.
SUPPORTED ASSETS
The indicator supports major assets across multiple classes. Precious metals include gold and silver comparing forex spot to COMEX futures. Energy includes crude oil comparing cash prices to NYMEX futures. Cryptocurrencies include Bitcoin and Ethereum comparing index prices to CME futures. Stock indices include S&P 500 and Nasdaq comparing cash indices to CME futures. Currencies include Euro and Yen comparing forex rates to CME futures.
LIMITATIONS
Spot and futures markets may have different trading hours, creating gaps in the spread calculation. Data quality varies between spot price sources. Transaction costs and execution risk affect whether theoretical arbitrage opportunities are practical. The indicator shows a single futures contract and does not capture the full term structure.
VERSION HISTORY
Version 1 released with five analysis modes, automatic symbol detection, comprehensive dashboard, regime classification, and arbitrage alerts.
CREDITS
Developed by Robinhodl21 as part of the Grandmaster Indicator Suite. Released under Mozilla Public License 2.0.
Скрипт с защищённым кодом
Этот скрипт опубликован с закрытым исходным кодом. Однако вы можете использовать его свободно и без каких-либо ограничений — читайте подробнее здесь.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с защищённым кодом
Этот скрипт опубликован с закрытым исходным кодом. Однако вы можете использовать его свободно и без каких-либо ограничений — читайте подробнее здесь.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.