This is what happens:
namespace QuantConnect
{
/*
* OANDA/QuantConnect Basic Template:
* Fundamentals to using a QuantConnect algorithm.
*
* You can view the QCAlgorithm base class on Github:
* https://github.com/QuantConnect/Lean/tree/master/Algorithm
*/
public class BasicTemplateAlgorithm : QCAlgorithm
{
//Initialize the data and resolution you require for your strategy:
public override void Initialize()
{
// Code Automatically Generated
// Date range for your backtest
// In live trading these are ignored.
SetStartDate(2017, 1, 1);
SetEndDate(2018, 1, 1);
// Set cash allocation for backtest
// In live trading this is ignored and your real account is used.
SetCash(5000);
// Specify the OANDA Brokerage: This gives lets us know the fee models & data.
SetBrokerageModel(BrokerageName.OandaBrokerage);
//Add as many securities as you like. All the data will be passed into the event handler:
AddSecurity(SecurityType.Forex, "EURUSD", Resolution.Tick, true);
AddSecurity(SecurityType.Forex, "EURJPY", Resolution.Tick, true);
AddSecurity(SecurityType.Forex, "USDJPY", Resolution.Tick, true);
}
// Event handler for the price events
public override void OnData(Slice data)
{
if (!data.ContainsKey("EURJPY")) return;
if (!data.ContainsKey("EURUSD")) return;
if (!data.ContainsKey("USDJPY")) return;
double TheoreticalUSDJPY = data["EURJPY"].Close/data["EURUSD"].Close;
double TheoreticalEURUSD = data["EURJPY"].Close/data["USDJPY"].Close;
double TheoreticalEURJPY = data["EURUSD"].Close*data["USDJPY"].Close;
double MispricingUSDJPY = TheoreticalUSDJPY-data["USDJPY"].Close;
double MispricingEURUSD = TheoreticalEURUSD-data["EURUSD"].Close;
double MispricingEURJPY = TheoreticalEURJPY-data["EURJPY"].Close;
Debug(MispricingUSDJPY);
}
}
}
and i get the error:
Runtime Error: 'System.Collections.Generic.List<QuantConnect.Data.Market.Tick>' does not contain a definition for 'Close' (Open Stacktrace)