Hello All.
I am trying to get a close price from a quote bar, but I get an error message "Runtime Error: The best overloaded method match for 'QuantConnect.Indicators.RollingWindow<QuantConnect.Data.Market.QuoteBar>.Add(QuantConnect.Data.Market.QuoteBar)' has some invalid arguments (Open Stacktrace)". Why?
My code is
public override void Initialize()
{
SetStartDate(2018, 01, 1); //Set Start Date
SetEndDate(2018, 02, 2); //Set End Date
SetCash(100000); //Set Strategy Cash
// Find more symbols here: http://quantconnect.com/data
// Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily.
// Futures Resolution: Tick, Second, Minute
// Options Resolution: Minute Only.
AddForex(_eurusd, Resolution.Tick);
// There are other assets with similar methods. See "Selecting Options" etc for more details.
// AddFuture, AddForex, AddCfd, AddOption
// Create a Rolling Window to keep the 2 QuoteBar
quoteBarWindow = new RollingWindow<QuoteBar>(2);
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
// Add EURUSD QuoteBar in rolling window
quoteBarWindow.Add(data[_eurusd]);
// Wait for windows to be ready.
if (!quoteBarWindow.IsReady) return;
var currentClose = quoteBarWindow[0].Close;
var previousClose = quoteBarWindow[1].Close;
if (currentClose > previousClose)
{
Debug(currentClose + " > " + previousClose);
}
else
{
Debug(currentClose + " < " + previousClose);
}
if (!Portfolio.Invested)
{
SetHoldings(_eurusd, 1);
Debug("Purchased Stock");
}
}