I want to program strategies based on volume delta. I would like to know how I can get the ask/bid volume on a candle that has completed. say 5 mins candle. based on the imbalance in the volume I am planning to create some strategies. Can some one please guide.
First and foremost you need a separate data vendor actually providing (historical) bid/ask volume data. AmiBroker are not a data vendor.
But alternatively to IQFeed you may use any other 3rd party vendors providing such data... to be accessed via other data plugin connection(s) (if vendor provide API access) or via (manual or programatic) ASCII data import (of CSV, TXT, ... files).
Additional note: If that volume data is stored to Aux fields you would need to set aggregation mode to "Sum" in File - Database settings - Intraday settings.
Small correction: IQFeed provide Bid/Ask price data (and AB IQFeed plugin storing that price data to Aux1 and Aux2 fields). But Bid/Ask volume data can be derived from bid/ask price. See response by IQFeed:
We provide the bid and ask price at the time of the trade, so if you look at the trade volume associated with trades at the bid or ask it will tell you what you are looking for. Thus, If the bid price = Last trade price then L Vol = Bid Volume. If the Ask = Last then L Vol = Ask Volume. We don't provide this as a field in any ways since it is easy for client software to calculate and analyze it however they want. Bid and Ask volume isn't something that is sent from the exchange. It is derived in the feed. The bid and ask price at the time of the trade is included in historical tick data as well so if you are looking for a cumulative number you can add it up by using history in conjunction with the stream.
Thanks for the reply, I am actually trying to view the code you have posted in unofficial amibroker forum. I have applied for membership in proboard it still says I am not authorized. Please help me join the group.
Ok I talked with my data vendor. They dont provide any signals in AUX1 or 2. Is it possible to do like this
Buy _volume = Iif(C >Ref(C,-1),volume,0);
Sell _volume = Iif(C <Ref(C,-1),volume,0);
If above said is ok. how to count every tick(run above pair of lines) inside every bigger time frame. like in 5, 10,15 minutes.