ietello

Futuros / SPOT Test

187 2 18
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
6 months ago
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
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out