Download MetaTrader 5

Terminate a test programmatically

To add comments, please log in or register

Hi all,

Does anyone of you know if there is a way to tell the MetaTrader tester that we just want to terminate a test.

For example, let's say that I want to run a test on a 5 years time frame and that after 3 months a condition is triggered on which I would like to stop the test.

The only way I have found now is to just call "return" for the remaining bars and I was wondering if there was a way to not consume that processor time on the remaining bars...

I hope that my explanation is clear and thank you for your help.

Just returning from start() is sufficient. I use this (don't know if it works)
string tradingDisabled = "";
void     DisableTrading(string msg){ tradingDisabled = msg+" Trading disabled.";
   CloseAllOrders();    AlertMe(tradingDisabled);  Comment(tradingDisabled);  
                                    double zero, die = 1. / zero;             }
int start(){ if(tradingDisabled != "") return;
To add comments, please log in or register