creationlayer

Bitcoin Index vs. Futures OKCoin Weekly

296 1 53
Simple adaptation to lastbattles script to add calculation for index price: calculation can be seen here: https://www.okcoin.com/future/market.do?symbol=2

I recommend setting it to columns, and setting price at 0, 0 to see divergence of sell/buy.
Remove from Favorite Scripts Add to Favorite Scripts
// Futures Fomo - Tradingview.com
// Update of @lastbattle script to account for OKCoin futures index scheme
study(title="Bitcoin Index vs. Futures OKCoin Weekly", shorttitle="Futures Price Difference")

// Inputs from user
notifyRed = input(0, 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
futures = security("OKCOIN:BTCUSD1W", period, close)
spot1 = security("BITFINEX:BTCUSD", period, close) 
spot2 = security("OKCOIN:BTCUSD", period, close)
spot3 = security("OKCOIN:BTCCNY / FX:USDCNH", period, close)
spot4 = security("HUOBI:BTCCNY / FX:USDCNH", period, close)
spot5 = security("BTCCHINA:BTCCNY / FX:USDCNH", period, close)
spot6 = security("BITSTAMP:BTCUSD", period, close)
spot = (spot1+spot2+spot3+spot4+spot5+spot6) / 6

// Functions
isNotifyRed(difference) => difference > notifyRed
isNotifyGreen(difference) => difference < notifyGreen

// Val
difference = nz(nz(futures[0]) - nz(spot[0]))

// Plots
plot(difference, style=line,  linewidth=1, color=isNotifyRed(difference) ? red : isNotifyGreen(difference) ? green : black)
I realize the indicator is based upon a rolling average of CNY price, but I do not know the exact methodology to implement this in the script any help is appreciated.
Reply
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out