Login Page - Create Account

Support Board


Date/Time: Sun, 16 Mar 2025 12:23:20 +0000



Post From: MBO tick data issue

[2022-08-17 11:56:25]
User907968 - Posts: 838
So how does this (or other prt of the code) help to prevent the issue?

Do you mean the issue with using sc.LastTradePrice?

If so it prevents the issue because you always start at the best bid or best offer (LevelIndex = 0 in the exmaple below, from studies2.cpp) when iterating through the market depth array, you then use the price obtained from the depth data to get the MBO data.

  
for (int LevelIndex = 0; LevelIndex < AskNumLevels; LevelIndex++)
{
  s_MarketDepthEntry MarketDepthEntry;
  sc.GetAskMarketDepthEntryAtLevel(MarketDepthEntry, LevelIndex);

  int ActualLevels = sc.GetAskMarketLimitOrdersForPrice(sc.Round(MarketDepthEntry.Price / sc.TickSize), NumberOfMarketOrderDataElements, MarketOrderData);

  for (int OrderDataIndex = 0; OrderDataIndex < ActualLevels; OrderDataIndex++)
  {
   uint64_t OrderID = MarketOrderData[OrderDataIndex].OrderID;
   t_MarketDataQuantity MarketDataQuantity = MarketOrderData[OrderDataIndex].OrderQuantity;
}

}

Does not need to be a trade for limit order book to move, so it is quite normal that the best bid/best offer can be below/above last trade price.
Date Time Of Last Edit: 2022-08-17 11:59:45