I'd like to develop an execution algorithm that takes into account recent trades and whether they occurred at the bid or at the ask.
I'm wondering if I can record the most recent Bid and Ask during the OnMarketData() method (using GetCurrentBid() and GetCurrentAsk()) and whenever the OnBarUpdate() method runs (with CalculateOnBarClose==false), compare the most recent Close[0] with the most recent Bid & Ask and look for a match.
My question is if OnBarUpdate() is called at the start of every bar, even if there was no trade, and, if so, which method should I use to find the price at which the last trade occurred?
All the best,
Ken

Comment