How to stop a backtest

 
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
 
Just stop entering new trades:



bool NoMore= false;

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



    ....

     if (criteria)
         NoMore= true;


    .

}




Markus

 
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
 
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