CGS

FuturesVsSpot

66
Btc futures vs spot indicator

Made by thedudebtc
Open-source script

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.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//Futures vs Spot

 
study(title = "FuturesVsSpot", shorttitle = "FuturesVsSpot")
 

ok3m = security("OKCOIN:BTCUSD3M",period, close)
ok2w = security("OKCOIN:BTCUSD2W",period, close)
ok1w =security("OKCOIN:BTCUSD1W",period, close)
stamp = security("BITSTAMP:BTCUSD",period,close)
usdcnh = security("FX_IDC:USDCNY",period,close)
btccny = security("OKCOIN:BTCCNY",period,close)
finex = security("BITFINEX:BTCUSD",period,close)

cny2usd = btccny/usdcnh

avg = (stamp+finex)/2
diff = ok1w-avg
diff2 = ok3m-avg
diff4 = ok2w-avg
diff3 = cny2usd-avg
 
col = diff<0 ? red : diff>0 ? green : gray
col2 = diff2<0 ? red : diff2>0 ? green : gray
 
hline(0,title="0")
plot(diff2, style=area,linewidth=1,color=aqua,transp=15)
plot(diff4, style=area,linewidth=1,color=yellow,transp=10)
plot(diff, style=area,linewidth=1,color=orange,transp=40)

plot(diff3, style=line, linewidth=2, color=white)