I am trying to build a data model where I can see the following for a new price level created in the inside bid / ask once the price moves into the new price level:
1. Starting volume
2. Total Transacted volume
3. Ending Volume
I can pick up the starting volume and ending volume from OnMarketDepth with something like.
if (marketDepthUpdate.MarketDataType == MarketDataType.Ask &&( marketDepthUpdate.Operation == Operation.Update || marketDepthUpdate.Operation == Operation.Add)&& GetCurrentAsk() == marketDepthUpdate.Price)
Then I can filter for price level changes by setting a variable to the old GetCurrentAsk() and when the new GetCurrentAsk() != to my variable I know that the price level has changed.
For the transacted volume: I can run something like this from OnMarketData:
if (marketDataUpdate.MarketDataType == MarketDataType.Last)
{
if (marketDataUpdate.Price >= marketDataUpdate.Ask)
{
Print( "Transacted Volume" + marketDataUpdate.Volume);
}
This is just some flavor of: https://ninjatrader.com/support/help...marketdata.htm
Both of these methods work fairly well independently and give me the data that I need. However they are not in sync together as far as the timing. For example, when the OnMarketDepth event handler is switching from price level x to price level y, the OnMarketData event handler is more often than not lagging and still stuck on price level x.
So getting these two to sync up is a bit of a challenge. I am sure I am not the first guy out there trying to get information from both event handlers at the same time concerning the same price level event. After searching this forum, I haven't found any information on this topic, so I figured I would post the question.
Can someone from NT point me toward the best practice for how someone can get data for a single bid or ask price from these two event handlers in sync?
Thanks,
Ian
Comment