Accurate Back Test

 

Hello,


I am new to MQL, I am confused about accuracy of back tests. Here this part I'm copying from user guide, in strategy testing part of trade platform :

Methods of Modeling

Historical data are saved in the terminal only as bars and represent records appearing as TOHLCV (HST format). These data can be used for modeling of price changes at testing of experts. In some cases, such information is not enough for testing. For example, for the daily timeframe, price changes within a bar can result in triggering of the expert. At the same time, no triggering can occur at testing. In other words, testing of an expert based on only bars can be inaccurate and give a false idea about the expert efficiency.

And, also not for just for back testing, I'm looking to some mql4 examples, they are using generally bars for calculations. Is there any way to use ticks in my programs? if yes for back testing is there any accurate data for really accurate tests?

Thanks.

 

From what I understand, the ticks option in the drop down testing box is the most accurate option to test on.


However I introduce random lags in my program of 1 - 10 minutes, this also helps with demo testing as lag from a live server can be a few minutes.
If your program can stand up to several minute halts before it gets new information to work with, its going to be more robust when you go live is my thinking.



 
Onyx:

From what I understand, the ticks option in the drop down testing box is the most accurate option to test on.


However I introduce random lags in my program of 1 - 10 minutes, this also helps with demo testing as lag from a live server can be a few minutes.
If your program can stand up to several minute halts before it gets new information to work with, its going to be more robust when you go live is my thinking.



What you mean as introducing random lags, can you give some examples?

 
metdos:

What you mean as introducing random lags, can you give some examples?


Sure, this isn't what I use as I have coded my own function for it but this should work:





CurrentTimeVariable = TimeMinute(TimeCurrent());

// Then some code to count down against the random number every minute, finally when:

if (CurrentTimeVariable >= LastTimeVariable + YourVariable )
{


---- Inside Main Code-----



LastTimeVariable = CurrentTimeVariable;


---- End of Program---


YourVariable = MathRand()%6;

// That should indicate from 0 - 5 minutes lag, I use 3 - 10 myself for really laggy testing.
}


LastTimeVariable should be initialised at 0 of course when you start each hour in this example. I use a combination of all the time functions in all my code to get more helpful format for long range orders, so I reset mine every month usually.

More on Random number functions here if my code for it is off
https://www.mql5.com/en/articles/1496


Sorry for the edit, that looks better.

Reason: