This forum is now read-only. You can discuss you questions on Forums of MQL4.community and MQL5.community

How to stop a backtest


Back to topics list
avatar
33
hardwood 2005.09.27 00:41 
Hello,

Does anyone know how I could, from the expert advisor code, stop a backtest that has reached a certain criterion?

Any help would be welcome.

Regards,

Hugh
avatar
239
Shimodax 2005.09.27 04:24 

Just stop entering new trades:



bool NoMore= false;

int start()
{
     if (NoMore)
        return (0);



    ....

     if (criteria)
         NoMore= true;


    .

}




Markus

avatar
33
hardwood 2005.10.03 22:26 
Markus,

Yes, I did manage to think of that... but if you have 10 years of 1 minute data, as I do, and the criterion exits after 100 days, MT will continue with the backtest for hours just doing nothing.

I was thinking of some instruction / trick to STOP the backtest. It does not even seem possible to stop the backtest manually!!

Thanks for trying!

Hugh
avatar
239
Shimodax 2005.10.04 02:13 

I never had problems stopping a backtest manually (and I had quite time consuming ones that would easily run for an hour on just two months of minute data). The stop button always did the trick for me.

The only time when the program got to be unresponsive was when I had a programming error with an infinite loop in an expert (some stupid stuff like for (i= OrderTotals(); i>0; i++) ...).


Markus
Back to topics list