Ask Bid volume of a bar


I am new to Amibroker (just downloaded the trial version). I am in process to code my Ideas from NT to amibroker. I have imported tickdata in amibroker in following format successfully:

Ticker, Date, Time, O, H, L, C, BidPrice/Aux1, Askprice/Aux2

I use Range bars of 100R. I want to display Bull volume (trades carried at and above ask price) and bear volume( trades carried at and below bid price).

But when i try to calculate using following code, the tick data is not accessible to code. It appears i am not able to access the lower TF data when i am using higher TF.

TimeFrameSet( -1 );
	 buy_vol = IIf( C >= Aux2, V, 0 ); //Buying volume or Ask Volume
	 sell_vol = IIf( C <= Aux1, V, 0 ); //Selling volume or Bid Volume
	 neutral_vol = IIf( ( C > Aux1 ) AND ( C < Aux2 ), V, 0 ); //Unknown

I want total of bull volume (sum of tick volumes traded at ask or above) to print above 100R bar and similarly for bear volume.

every time i start amibroker, i have to import data again!!

Trial Version ? Are there limits to saving data ?

ok got it, any idea about ask-bid question

I am using IQFeed and get the Volume at Tick. So to get the Buy and Sell Volumes in other time frames you have to first collect the data in a Tick chart (like your code):

BuyVolume = IIf( Close >= Aux2 AND Aux2 != Aux1, Volume, 0 );
SellVolume = IIf( Close <= Aux1 AND Aux2 != Aux1, Volume, 0 );

Then you send off the data to other time frames (TF equal to the TF you want to send the data to. Ticker = Name() ):

BuyVolComp = TimeFrameCompress( BuyVolume, TF, compressVolume );
BuyVolExp	= TimeFrameExpand( BuyVolComp, TF,  expandFirst );
StaticVarSet( "~BuyVolume" + Ticker + TF, BuyVolExp, False );

SellVolComp = TimeFrameCompress( SellVolume, TF, compressVolume );
SellVolExp	 = TimeFrameExpand( SellVolComp, TF,  expandFirst );
StaticVarSet( "~SellVolume" + Ticker + TF, SellVolExp, False );

Then in your chart with the TF timeframe you collect the data:

BuyVolume = Nz( StaticVarGet( “~BuyVolume” + Ticker + TF ) );
SellVolume = Nz( StaticVarGet( “~SellVolume” + Ticker + TF ) );

And that’s about it.



Since i am using 100R bars, how to use timeframecompress and timeframeexpand.

Sorry, that I am not sure about since I am using time-based charts. But my guess is that since you use Range bars, you can’t do time compression/expansion and instead have to collect the data in the tick chart and code it accordingly to your defined range and then just send it to your 100R chart using StaticVarSet…