Volume Delta on HFT markets

My goal is to develop a VOLUME DELTA indicator that can be used for history and real time data. It should be able to evaluate if a new trade was either a buy aggression or a sell aggression by comparing the trade price with both best bid and ask prices at the exact same moment. Since Amibroker doesn’t have bid and ask history capabilities and that any development made on history data should be good to be used in real time, I came to the conclusion that I’d need to calculate past values using a script outside Amibroker and then load the indicator’s final values into Amibroker tick by tick (so that each trade in the history have its corresponding indicator value). For real time feed I’d need to check live bid and ask data and write the values to the indicator history database. My questions:

  1. What’s the least resource-heavy method to store the indicator values for future use that enables me to update it on every single trade? I will use this indicator for backtest so speed is important. I’ve had bad experiences on other platforms reading TXT files, which turned to be a very slow process due to hard disk read times and searching times within the file

  2. Is Amibroker able to read at the same time the trade price (market order) and best bid/ask prices (limit orders) from the times & trades? I cannot wait a microsecond as bid/ask prices are very volatile, because HFTs change them all the time. The ideal solution would be to gather trade price and best bid and ask prices at the same moment using a single function call, so I can guarantee that I’m reading the feed only once not risking to include any new information that could distort the result (such as a new bid or ask price). For instance, using GetRTData(’‘fieldname’’) would yield me 3 distinct function calls (last; bid; ask), so my perspective is that in between these calls one of the variables could have been changed in real time. Another concern is the time elapsed between the identification that a new trade has happened and the return of the values from the function. Often HFTs change bid/ask prices according to trades, so it takes more time for my platform to identify a new trade and send the commands than it takes for the HFTs to change the bid and ask prices (as they’re hosted on the exchange servers and hardware coded). Which takes us to #3 below…

  3. On Amibroker, how do I know when a new information has been written on the times & trades? Is Amibroker able to identify a new limit order, or does it just identify a new market order? Where no level 2 information is available, a new “tick” is just a new trade, but in this case I might need to identify a change in the order book, which means that a new limit order has been either registered or cancelled. Are there functions to read the live times and trades? Is the Amibroker times and trades complete with all limit orders (bid and ask prices)?

I appreciate your suggestions.

Thank you,

I was told Amibroker can store historical bid and ask prices. It’s my mistake for not having made this clear: regardless of Amibrokers ability to work with bid-ask history, the way data vendors store past bid-ask information is to have it embedded in the times & trades history. That works just fine for me, as I can rebuild the historic volume delta outside Amibroker.

Please take this into consideration when replying to this topic.

I stopped reading at this line. Suggestion: check what 1 microsecond really is, what is the ping time from exchange to you and such things…

I’m sorry that you cannot understand a figure of speach.

My ping for my broker is between 4ms and 20ms. My broker must’ve his own ping time to the exchange which is unknown to me.

The interval time between trades is often under 10ms, so I cannot wait information to arrive at my computer to send a command to gather bid-ask prices as the HFTs may have already changed that. HFTs have their algos hardware coded and are hosted on the exchange data center.