Automatically end backtests/optimizations early?

 

Is there a command which can forcefully stop a runthrough of a backtest or optimization pass from within the EA code?

Also, in MT4 there is an auxiliary list of optimization parameters for the inputs which will stop an optimization pass if a value is exceed. For example, maximum % drawdown can be set and the tester will automatically skip to the next pass if the current pass exceeds that value at any time.

I cannot even seem to find anything like this on the external tester controls either.

I keep hitting a problem when certain backtests end up with not enough money to open a trade, and so the backtest just sits there and goes painfully slowly until the end of the testing period. It does this even more slowly than it does int MT4! I have placed the entire contents of the OnTick() function into a conditional which checks to make sure there is enough money, but this barely speeds things up very much at all. Ideally it would be great to tell the backtest to stop straight away.

 
hatlle:

Is there a command which can forcefully stop a runthrough of a backtest or optimization pass from within the EA code?

Also, in MT4 there is an auxiliary list of optimization parameters for the inputs which will stop an optimization pass if a value is exceed. For example, maximum % drawdown can be set and the tester will automatically skip to the next pass if the current pass exceeds that value at any time.

I cannot even seem to find anything like this on the external tester controls either.

I keep hitting a problem when certain backtests end up with not enough money to open a trade, and so the backtest just sits there and goes painfully slowly until the end of the testing period. It does this even more slowly than it does int MT4! I have placed the entire contents of the OnTick() function into a conditional which checks to make sure there is enough money, but this barely speeds things up very much at all. Ideally it would be great to tell the backtest to stop straight away.


Can try to check if your account have enough money to open a position else do a return,

this should be a workaround of your problem 

 
There is ExpertRemove function
 
hatlle:

Also, in MT4 there is an auxiliary list of optimization parameters for the inputs which will stop an optimization pass if a value is exceed. For example, maximum % drawdown can be set and the tester will automatically skip to the next pass if the current pass exceeds that value at any time.



Cant you use "continue", to skip to the next pass? I would like to know if there is a function to reffer to the %drawdown...

 
Slava:
There is ExpertRemove function

Thank you

Reason: