OPEN-SOURCE SCRIPT

Binance Perp Premium/Discount

This TradingView Pine Script indicator calculates and displays the premium or discount percentage between a cryptocurrency's spot price and its corresponding perpetual futures (perp) price on Binance. It automatically detects whether the current chart symbol represents a spot or perp market by checking for the ".P" suffix. The script then retrieves the closing prices for both the spot and perp symbols using the request.security function. If valid data is available for both markets, it computes the premium or discount as a percentage and visualizes this difference as a histogram below the main chart. Green bars indicate a premium (perp price above spot), while red bars signify a discount (perp price below spot). The indicator includes error handling to display 'n/a' when data for the required symbols is unavailable, ensuring robustness across various chart applications.
sentimentVolume Indicatorvolumedelta

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明