[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] global tick/point sizes using static variables for futures



PureBytes Links

Trading Reference Links

This may save others the time to plot symbol/tick normalized charts.
I use this code quite often:

At the beginning of the price I have: (names are for IB data)

 

NameL = StrLeft(Name(),4); //truncate Symbol to 4 cahracters used in
Titles

SymbL1 = StrLeft(Name(),1); //truncate name to 1 left char,
differentiate start time of currencies

SymbL2 = StrLeft(Name(),2); //truncate name to 2 left character 

StaticVarSet("NameL"+Name(),NameL);

StaticVarSet("SymbL1"+Name(),SymbL1);

StaticVarSet("SymbL2"+Name(),SymbL2);

 

Title = NameL+StrFormat("- {{INTERVAL}} {{DATE}} , C=%g,
V={{VALUES}}"+NumToStr(Volume,1.0,separator=True), C);

 

//permanent TickSize for all futures

TickSize_ = IIf(SymbL1 == "6" OR SymbL2 ==  "E7", 0.0001, 

            IIf(SymbL2 == "6B" , 0.0002,

            IIf(SymbL2 == "6J" , 0.000001,

            IIf(SymbL2 == "ER" OR SymbL2 == "SP" OR SymbL2 == "IN" OR
SymbL2 == "ME", 0.1,

            IIf(SymbL2 == "ES" OR SymbL2 == "NQ", 0.25,

            IIf(SymbL2 == "YM" OR SymbL2 == "TI", 1.0, 0.01))))));

 

InvTick = Nz(1/TickSize_) ; // save On divisions

 

StaticVarSet("TickSize_"+Name(),TickSize_);

StaticVarSet("InvTick"+Name(),InvTick[BarCount-1] ) ; 

 

___________________________________________________________

 

Then, in each pane that uses this information I have the corresponding
match:

 
 

NameL  = StaticVarGet("NameL"+Name()); 

SymbL1 = StaticVarGet("SymbL1"+Name()); 

SymbL2 = StaticVarGet("SymbL2"+Name()); 

 

TickSize_ = StaticVarGet("TickSize_"+Name()); 

InvTick   = StaticVarGet("InvTick"+Name()); 



Joseph Biran
____________________________________________




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006