ietello

Futuros / SPOT Test

203 2 20
snapshot
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 PRO 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
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
Việt Nam
日本
한국
简体
繁體
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 Priority Support Contact Support Ideas Published Followers Following Private Messages Chat Sign Out