Loop multiple times with one Expert and write results to file

 
Hi,

Is it possible to loop with one Expert using different extern properties, detached from chart and saving result to file?

If for example my Expert use 2 EMA for buy/sell and I would like to loop to test different case as :

// Test for the first with EMA(15) to EMA(32) and the second EMA(6) to EMA(12)

for( int a=15 ; a <= 32; a++){
for( int b=6; b < 12; b++){
' set my "extern" variables of my Expert "a" and "b"
MyExpert.a = a;
MyExpert.b = b;
MyExpert.start();
' Write to file the final result, number of trades, goods and bads, final amount "a-b;totalTrades;goods;bads;finalAmount"
' After if I need more details I could replay it directly from MetaTrader System Tester with the specific properties
}
}

If you can provide me a little example, it will be really appreciate.

Thanks for your help.
 

the best way is to use optimizer and encode your file name with the variables something like this:

"expfile_ma"+a+"_ma"+b+".log"

you canr run optimizer in steps optimizing one variable and changing second manually to make it manageable:

such a=15 optimize b=6 to 12,

a=16 optimize again b=6 to 12 and so on.

 
Thanks, but I still a bit confuse of how you write code to start looping execution with my differents properties at each iteration.

In Java we could use de main(String[] args) function .... create instance of class and set properties before starting process.

but in MQL4 how can you start it (always not attached to charts ) , create a new test with new properties at each iteration?


Sorry I'm very new in MQL4 but I have experience with Java ... if you want to use another language for comparaison.


Thx