How to get a close price from a QuoteBar?

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:
// 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

// 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);
Debug(currentClose + " < " + previousClose);

if (!Portfolio.Invested)
SetHoldings(_eurusd, 1);
Debug("Purchased Stock");
Update Backtest

Hi Akira,

If you use Tick resolution, you should create tick rolling window. tick resolution is different from other resolution. data[symbol] is a list of tick data within one second. You should loop this list to the tick to the rolling window. A tick is the minimum movement in the price of a security and it does not have the closing price. Only AskPrice and BidPrice are available. Please see this example


Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed