Volume Delta

0 votes
asked May 25, 2017 in AFL Code Wizard by Eduardo
Hi, I'm considering moving from Ninjatrader to Amibroker for performance and stability issues. Before making the move, I'd like to be sure that I'll be able to code an indicator based on the Bid Volume and Ask Volume. Having no knowledge of AFL so far, I need to make sure that my indicator will be able to:

1) be used in strategies and be plotted on charts;

2) be calculated using real time values based on best bid and best ask prices compared to last tick value, regardless of current time frame used on chart or strategy;

3) backfill based on up_tick and down_tick, assuming I have tick by tick history data, regardless of current time frame used on chart or strategy;

Could anyone confirm if this is possible in Amibroker? What would I have to do? Does something like this already exist?

Thank you!

1 Answer

0 votes
answered May 25, 2017 by admin (9,260 points)
To do what you want you need to have not only current Bid/Ask data but also historical. The only AmiBroker-compatible data source that currently feeds historical bid/ask together with historical ticks is IQFeed. Indicators based on historical bid/ask prices are quite easy. But with indicators based on bid/ask volume the trouble is that we have historical bid/ask prices not bid/ask volumes. Historical Volume figures are for actual trades (trade size) not for offers. In theory you could collect realtime (current) bid size and ask size in static variables to build the history yourself and use that, but this requires quite a bit of programming knowledge.
commented May 25, 2017 by Eduardo
Thank you for your reply.

I could use historic ticks and assume that an uptick is a buy order and a downtick is a sell order. Then I could use corresponding volumes. Trades on the same tick price would be treated as in the same direction as previous tick. This gives a good approximation.

My question was if I could use tick data on a larger timeframe chart or strategy, meaning I'd be using a multi-timeframe approach for both charting and for the strategy. Ninjatrader only implemented that on version 8 released last year. I assume amibroker has it too, but I'd need such confirmation and a general guidance for such solution.
commented May 26, 2017 by admin (9,260 points)
Multiple time frame functionality is described here:
https://www.amibroker.com/guide/h_timeframe.html

But from your description it looks like you want to calculate our indicator once and reuse it in many places for performance reasons. If so, you could have one chart using tick data to calculate your indicator based on ticks and store results in a static variable. Then such static variable can be read in any other interval quicker than re-doing calculations. And that would benefit from multithreading.

Regardless of technique used the devil is in the details.
I don't know how many symbols at once you want to calculate but this can be quite resource heavy. I don't know exactly what your expectations are but for some information about the performance see
http://www.amibroker.com/guide/h_multithreading.html
commented May 26, 2017 by Eduardo
THANK YOU! Cheers!
...