ietello

Futuros / SPOT Test

205 2 20
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title="Futuros / SPOT Test", shorttitle="Diferencial de futuros")

// Inputs from user
notifyRed = input(30, title="Sell warning")  // when difference is > x
notifyGreen = input(10, title="Buy warning") // when difference is > x
timePerod = input(-1, title="Time period [-1 = go by chart]", minval=1)

// Security
futures = security("OKCOIN:BTCUSD3M", 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
spot = (spot2)
// Functions
isNotifyRed(difference) => difference > notifyRed
isNotifyGreen(difference) => difference < notifyGreen

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

// Plots
plot(difference, style=line,  linewidth=2, color=isNotifyRed(difference) ? red : isNotifyGreen(difference) ? green : black)

//strategy("Future Strategy", overlay=true)

//vrsi = rsi(close, 14)

//if (not na(vrsi))
 //if (crossover(vrsi, overSold))
   //     strategy.entry("RsiLE", strategy.long, comment="RsiLE")
This looks interesting. What does it do exactly?
Reply
ietello dave.seremek
compare the prices of spot and futures to detect areas of long and buy. Mark in green the Buy zone and Red Sell Zone
Reply
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
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