Thanks again for a quick reply 
The code runs fairly quickly, on the select 100000 bars it checks code on, but as soon as it starts using all the data bars it slows considerably.
i have read the setbars required and played around with different settings, but nothing improved.
in the amibroker main windows the performance load on AFL is 80ms 40% and data access time 489ms 244%
i am only running 10 symbols in this database


_SECTION_BEGIN("Tick bids volume trials");
Ticker = Name();
Large = 10;
Giant = 20;
//TimeFrameSet( -1 );
TF = -20;
TF2 = -250;
BuyVolume = IIf( Close >= Aux2 AND (Aux2 != Aux1), Volume, 0 );
SellVolume = IIf( Close <= Aux1 AND (Aux2 != Aux1), Volume, 0 );
//////////////large volume////////////
largesize = Param("large volume size",8,2,50,2);
doublesize = Param("double volume size",5,2,10,1);
large_buy_volume = IIf(buyvolume>=largesize,volume,0);
Large_sell_volume = IIf(sellvolume>=Largesize,volume,0);
large_buy_volumeComp = TimeFrameCompress( large_buy_volume, TF, compressVolume );
large_buy_volumeExp = TimeFrameExpand( large_buy_volumeComp, TF, expandFirst );
StaticVarSet( "~large_buy_volume" + Ticker + TF, large_buy_volumeExp, False );
Large_sell_volumeComp = TimeFrameCompress( Large_sell_volume, TF, compressVolume );
Large_sell_volumeExp = TimeFrameExpand( Large_sell_volumeComp, TF, expandFirst );
StaticVarSet( "~Large_sell_volume" + Ticker + TF, Large_sell_volumeExp, False );
//////////////////////////////////////////////
////////////Giant Orders/stops/////
g_buy_orders = IIf(buyvolume>=giant,1,0);
g_sell_orders = IIf(sellvolume>=giant,1,0);
g_buy_ordersComp = TimeFrameCompress( g_buy_orders, TF, compressVolume );
g_buy_ordersExp = TimeFrameExpand( g_buy_ordersComp, TF, expandFirst );
StaticVarSet( "~gBuyVolume" + Ticker + TF, g_buy_ordersExp, False );
g_sell_ordersComp = TimeFrameCompress( g_sell_orders, TF, compressVolume );
g_sell_ordersExp = TimeFrameExpand( g_sell_ordersComp, TF, expandFirst );
StaticVarSet( "~gsellVolume" + Ticker + TF, g_sell_ordersExp, False );
//////////////////Number of buys or sells//////
buynum = IIf(buyvolume>=1,1,0);
buynumComp = TimeFrameCompress( buynum, TF, compressVolume );
buynumExp = TimeFrameExpand( buynumComp, TF, expandFirst );
StaticVarSet( "~buynum" + Ticker + TF, buynumExp, False );
Plot(buyvolume,"Buyvolume",colorGreen,styleHistogram,0,0);
Plot(Sellvolume,"Sellvolume",colorRed,styleHistogram,0,0);
_SECTION_END();
Cheers
Jon