LastBattle

[Bitcoin] Spot price vs Futures indicator

A handy script to detect opportunities in the futures market during extreme movement.
During rallies, futures usually tend to be US$10 above spot price, on the other hand it can be $1 below spot price when the price starts to decline.

You could also draw a trendline to it :) measuring the amount of risk people are willing to take just to predict future prices in the rally/decline.

Credits to lowstrife for the idea, I'm just implementing it :)

Skrip open-source

Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Inggin menggunakan skrip ini pada chart?
// Spot price vs futures - Tradingview.com
// @author lastbattle
study(title="spot Vs Futures", shorttitle="spot vs futures [lastbattle]")

// Inputs from user
notifyRed = input(8, title="Sell warning")  // when difference is > x
notifyGreen = input(0, title="Buy warning") // when difference is > x
timePerod = input(-1, title="Time period [-1 = go by chart]", minval=1)

// Security
src_796 = security("796:BTCUSD1W", period, close)
src_btce = security("OKCOIN:BTCCNY / FX:USDCNH", period, close) 
// Futures: OKCOIN:BTCUSD1W, 796:BTCUSD1W, OKCOIN:BTCUSD2W, OKCOIN:BTCUSD3M
// Spot: BITSTAMP:BTCUSD, BITFINEX:BTCUSD, BTCE:BTCUSD, OKCOIN:BTCCNY / FX:USDCNH, HUOBI:BTCCNY / FX:USDCNH

// Functions
isNotifyRed(difference) => difference > notifyRed
isNotifyGreen(difference) => difference < notifyGreen

// Val
difference = nz(nz(src_796[0]) - nz(src_btce[0]))

// Plots
plot(difference, style=line,  linewidth=1, color=isNotifyRed(difference) ? red : isNotifyGreen(difference) ? green : black)

// Band range
//fill(hline(-10), hline(-8), color=green, transp=50)
//fill(hline(10), hline(8), color=red, transp=50)