The difference between this script and already published scripts is that it tracks the premium relative to 3 different reference prices. This tends to produce slightly different results.
This script is also open source, so you can verify the calculations, or use it as a basis for your own script.
The 3 plots uses the following reference prices:
Bitmex Index price, ticker: BITMEX:XBT
Bitmex Perpetual Premium, ticker XBTUSDPI
(This one is not used as reference, but simply plots the ticker*100)
The reference here is a price calculated by the tickers in trading view based on the Bitmex indices with weighing as follows:
Please note that Bitmex changes the bases of its indices regularly. Bitmex might also "rule out" on of these exchanges if there is a short term problem.
Added Tradingview Bitcoin Index as reference price (Default to yellow line)
Bitmex indices updated as of 26.Mars 2021 (Affects the default orange line including its history)
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.