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 :)

Skript med en öppen källkod

I sann TradingView-anda har författaren publicerat detta skript med öppen källkod så att andra handlare kan förstå och verifiera det. Hatten av för författaren! Du kan använda det gratis men återanvändning av den här koden i en publikation regleras av våra ordningsregler. Du kan ange den som favorit för att använda den i ett diagram.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här skriptet i ett diagram?
// 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)