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

Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?
// 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)