How to make the tester run faster?

It is often necessary to test our EA using the tester in visual mode, for instance when testing harmonic indicators or when we need to see if an EA sends orders correctly, but we don’t really care about visual orders history.

There is an easy way of making the tester run faster – removing unnecessary objects from the chart (which means objects associated with transactions history). Below, I present you sample code for doing just that:

void cleanChart() {

    if(!IsTesting() || !IsVisualMode()) return;

    if(ObjectsTotal()>50) {
     for(int i=0;i<ObjectsTotal();i++) {
      string name=ObjectName(i);

      if(StringSubstr(name,0,1)=="#") {
       ObjectDelete(name);
      }
     }
    }
}

The improvement in efficiency can be visible especially when testing on longer time periods or in strategies, which somehow use chart objects or execute lots of transactions.

Share with your friends:

Send us your comments

Name (required)

Email (required)

Message

  • Facebook