static classType

samjesse

Active Trader
Aug 30, 2011
118
0
27
Hi

I need to re_instantiate the object if a condition is met inside the OnCalculate.

Will the following be the BEST way?

many thx

MQL5:
int OnCalculate(...
 
static ClassType var_name1(_Symbol, _Period);   
int x = 1;
if(x) var_name1 = new ClassType var_name2(_Symbol, _Period);
 
Last edited by a moderator:

samjesse

Active Trader
Aug 30, 2011
118
0
27
Not sure, sorry. Why would you need that?

to reduce the overhead.

How many times will the constructor be called in the following code?

MQL5:
int OnCalculate(...
 
static ClassType var_name1(_Symbol, _Period);
 
Last edited by a moderator: