thedude

FuturesVsSpot

594 views
80
594 0
Futures Vs Spot Ratio
Remove from Favorite Scripts Add to Favorite Scripts
//Futures vs Spot

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

len=input(5, minval=1)

usdcny = security("FX_IDC:USDCNY",period, close)

okhigh = security("OKCOIN:BTCUSD1W",period, high*usdcny)
oklow = security("OKCOIN:BTCUSD1W",period, low*usdcny)
okclose =security("OKCOIN:BTCUSD1W",period, close*usdcny)
okcny = security("OKCOIN:BTCCNY",period,close)

huobi = security("HUOBI:BTCCNY",period,close)

ratio = (okclose/okcny)-1
ratioema = ema(ratio,len)

col = ratio<0 ? red : ratio>0 ? green : gray

hline(0,title="0")
plot(ratio, style=histogram,linewidth=1,color=col)
plot(ratioema,style=line,linewidth=1,color=col)
bgcolor(color=col,transp=95)
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Get Help Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing TradingView Coins My Support Tickets Get Help Ideas Published Followers Following Private Messages Chat Sign Out