@Slawa: UninitializeReason while Optimizing

 
Slawa:

I have the following code in my deinit() function:

if( IsOptimization() && ( UninitializeReason()==0 )) {
// Do Stuff
}

For optimization I am specifying parameters on the Limitation tab. However, when MT4 terminates a pass due to a limitation being exceeded (DrawDown too high for example), UninitializeReason() is still set to zero.

Can you add another "Uninitialize Reason Code" that specifies that the EA was deinitialized during optimization due to a limit being exceeded? Having a non-zero value in this case would allow me to weed out those passes.

Thank you!
 
Your request is clear. Sorry, in the near future it is impossible.

You ned for workaround. For example write current datetime at uninit function into file. Or analyze tester log.
 
OK.

Is there some way I can tell if all the bars have been tested? For example, can I retrieve the Time of the last bar in the chart, even if it's in the future? That way if the current tick (at early termination) is 02/01/2007, but the last bar to be tested is 02/28/2007, I know that it terminated early.

Thanks
 
No, You cannot get "to" date from settings and from chart. You can analyze sequence of dates. If 2 or more dates are equal and greater than other dates, then you can assume this is end date.
 
I'm sorry Slawa, but I don't quite understand. Can you provide a code snippet?
 
It should be 2 passes.
At the first pass You search latest date. After this pass You assume searhed date as normal ending date.
At the second pass You compare each date with normal end date.
Reason: