Skipping useless optimization passes. Possible?

 

Is there a way to skip any given pass of an optimization before that pass is completed? For example, if the relative drawdown % of a pass is too high at any point in that pass, then it is a waste of time to continue to the end of that pass, and it is better to skip straight to the next pass.

I have been placing the contents of the start() function inside a conditional which is true by default until some chosen event triggers it to become set as false.

The EA proceeds normally until the conditional is set to false, and then it only has to check that one conditional from there every tick until the end of the test period. This causes it to sprint the last part of the backtest without wasting time on all the normal EA gubbins.

However, on a 2 yr PERIOD_M5 backtest it still takes nearly 30 seconds to complete the backtest even after the conditional is set to false in the first few bars. This is obviously a waste of time in optimizations, and I can't think of a way to speed it up.

Is there some command from within an EA that will stop a backtest or an optimization pass in its tracks and skip straight to the end, or to the next pass?

(I tried calling deinit() from the start() function, but that didn't work either. I can't find any other topics on this, but then there are so many different ways to name the problem that I might just not be typing in the right thing. Sorry if this has been asked before.)

 
expert properties -> optimization tab
 
WHRoeder:
expert properties -> optimization tab

Thanks. I had spotted them. (Although I've never managed to get it to stop defaulting to a maximal drawdown of anything other than "70").

Unfortunately I only gave drawdown as an example. I'm actually looking to find a variety of kurtosis measurements and other non-standard info (such as frequency of trades) for each pass, which MT4 won't calculate by default, and which I don't think I can add to that list.

 
string  tradingDisabled;        
int init(){     tradingDisabled = ""; ... }
void DisableTrading(string msg){        tradingDisabled = msg+" Trading disabled.";
    Alert(tradingDisabled);     Comment(tradingDisabled); CloseAllOrders(); }
int start(){
    if (tradingDisabled != ""){    Comment(tradingDisabled);  return(0); }
    :
    if (FrequencyOfTrades > MAX_FREQUENCY) DisableTrading("FrequencyOfTrades="+FrequencyOfTrades);
 

Thanks. I really appreciate your help!

As far as I can tell, placing "return(0);" as a command attached to a conditional at the start of the start() function is the same as placing the entire contents of the start() function in the command section of that same conditional.

Either way it just skips straight to the end of the start() function without further delay. Unfortunately it still runs that every bar until the end of the test period, which is still taking nearly 30 seconds for 2 yrs of 5 min bars on my computer. That's nearly as long as the full EA takes.

The optimization tab filters DO skip the entire optimization pass. For example if the drawdown is set to "1", then it seems to complete several hundred optimizations in just a few seconds. It would be great to implement that same outcome from inside the EA so that it can be used with any metric, but I guess there is no specific command for that.

The only thing I can think of is to get failing passes to commit harakiri when they go bad, by triggering a "suicide trade" with the largest lotsize possible until it trips the optimization filter for drawdown ... and then keeping a record of which optimization passes did that in an output file.