OPEN-SOURCE SCRIPT

Spot - Fut spread v2

88
The "Spot - Fut Spread v2"
indicator is designed to track the difference between spot and futures prices on various exchanges. It automatically identifies the corresponding instrument (spot or futures) based on the current symbol and calculates the spread between the prices. This tool is useful for analyzing the delta between spot and futures markets, helping traders assess arbitrage opportunities and market sentiment.

Key Features:
- Automatic detection of spot and futures assets based on the current chart symbol.
- Supports multiple exchanges, including Binance, Bybit, OKX, MEXC, BingX, Bitget, BitMEX, Deribit, Whitebit, Gate.io, and HTX.
- Flexible asset selection: the ability to manually choose the second asset if automatic selection is disabled.
- Spread calculation between futures and spot prices.
- Moving average of the spread for smoothing data and trend analysis.

Flexible visualization:
- Color indication of positive and negative spread.
- Adjustable background transparency.
- Text label displaying the current spread and moving average values.
- Error alerts in case of invalid data.

How the Indicator Works:
- Determines whether the current symbol is a futures contract.
- Based on this, selects the corresponding spot or futures symbol.
- Retrieves price data and calculates the spread between them.
- Displays the spread value and its moving average.
- The chart background color changes based on the spread value (positive or negative).
- In case of an error, the indicator provides an alert with an explanation.

Customization Parameters:
-Exchange selection: the ability to specify a particular exchange from the list.
- Automatic pair selection: enable or disable automatic selection of the second asset.
- Moving average period: user-defined.
- Colors for positive and negative spread values.
- Moving average color.
- Background transparency.
- Background coloring source (based on spread or its moving average).

Application:
The indicator is suitable for traders who analyze the difference between spot and futures prices, look for arbitrage opportunities, and assess the premium or discount of futures relative to the spot market.

Contact - https://t.me/Alek_Mel

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.