Speed up Backtesting/Skip Useless Ticks

 

Hi All,

My Mt4 Platform is performing poorly with my EA in backtesting. I wish to speed things up a bit so i thought i could skip the useless ticks that are in between the high and low of each bar. Could anyone share a functional code for that? I saw on the mql4 forum a post that describes a bit of the process but i couldn't figure out the code. Thanks in advance Here is what i saw..

//+------------------------------------------------------------------+//| Skip useless ticks |//+------------------------------------------------------------------+double CA.below, CA.above=0; // Export to startvoid CallAgain(double when){

if (when>=Bid && CA.above > when) CA.above = when;

if (when<=Bid && CA.below < when)

CA.below = when;

return;

}

//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+int start(){ static datetime Time0;

bool newBar = Time0 != Time[0], useless = CA.below <= Bid && Bid <= CA.above;

if (useless && !newBar) return(0);

#define INF 9999999

CA.below = 0;

CA.above = INF;

Time0 = Time[0];

if (!useless){

OnTick(); // Will reset CA's

ModifyStops();

OpenNew();

} // Not useless

 

Anyone ? Any insights?

 

Only my opinion:

You can declare all the ticks from the Strategy tester as useless , consequently skip them, and use a "simple" indicator to display directly on chart all the trades that were to be made by your strategy. The indi can be downloaded from here https://www.mql5.com/en/forum/180141 .

Pro: the speed of the strategy testing is improved quite a bit.

Con: there are some lines to change in the indi in order to code your strategy.

 

Is there any way to improve/implement the first idea ?

 
investguy:
Is there any way to improve/implement the first idea ?

investguy

You can not do the for one simple reason : even in back-test you do not "know" which will be the high and the low of the current bar (even if you try to "trick" it by using some multi time frame functions, it will avoid doing it as soon as the testing time frame is compared to the required time frame and they are found to be equal)

So the idea to have only highs and lows is not applicable in back-testing

____________________

PS: that code snippet has a flow - it will only execute once per a new bar so it will completely ignore any price other than open (since close, high and low on the opening of the new bar should be the same with open)

Reason: