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

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?
// 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)