Hello,
I have read on the forum that StaticVar through the Amibroker engine automatically compress to the different timeframes as long as they are a multiple of the same base time the Var is set in, so 1 min can be read in 5/15min timeframes. but am having a bit of trouble executing it.
At the moment the only way i can get it to work is by creating 2 different Staticvars set to the different timeframes (-20 and -260) IE the following way
in the Tic window i have this
_SECTION_BEGIN("Just collecting Tick bids volume");
Ticker = Name();
TF = -20;
TF2 = -260;
BuyVolume = IIf( Close >= Aux2 AND (Aux2 != Aux1), Volume, 0 );
SellVolume = IIf( Close <= Aux1 AND (Aux2 != Aux1), Volume, 0 );
BuyVolComp = TimeFrameCompress( BuyVolume, TF, compressVolume );
BuyVolExp = TimeFrameExpand( BuyVolComp, TF, expandFirst );
StaticVarSet( "~BuyVolume" + Ticker, BuyVolexp, False );
SellVolComp = TimeFrameCompress( SellVolume, TF, compressVolume );
SellVolExp = TimeFrameExpand( SellVolComp, TF, expandFirst );
StaticVarSet( "~SellVolume" + Ticker, SellVolexp, False );
BuyVolComp2 = TimeFrameCompress( BuyVolume2, TF2, compressVolume );
BuyVolExp2 = TimeFrameExpand( BuyVolComp2, TF2, expandFirst );
StaticVarSet( "~BuyVolume2" + Ticker, BuyVolexp2, False );
SellVolComp2 = TimeFrameCompress( SellVolume2, TF2, compressVolume );
SellVolExp2 = TimeFrameExpand( SellVolComp2, TF2, expandFirst );
StaticVarSet( "~SellVolume2" + Ticker, SellVolexp2, False );
Then in each chart set of 20 tics or 260 tics i have the following
20 tic
BuyVolume = StaticVarGet( "~BuyVolume"+ Ticker + -20 );
SellVolume = StaticVarGet( "~SellVolume" + Ticker + -20 );
260 tic
BuyVolume = StaticVarGet( "~BuyVolume"+ Ticker + -260 );
SellVolume = StaticVarGet( "~SellVolume" + Ticker + -260 );
I would just like to remove excess code or duplication where i can.
Any help would be appreciated.
Cheers
Jon