Download MetaTrader 5

Multi time frames testing

To add comments, please log in or register
gizbar_g
13
gizbar_g 2014.02.11 22:05 

Hello everyone,

I wonder if there is a way to bypass the conflict between the time frame chosen in the tester settings 

Ea Setting

and the time frame the expert is initialized with in the input params.

Input 

Every time this conflict happens I get this annoying massage:

Tester stopped 

My aim is to run the tester on every time frame available much like the possibility to do so on all the symbols on the MarketWatch.

Doing it one by one, although possible, is kind of lame.

Here is a part of the code involved:

Code 

Any feedback will be extremely appreciated.

Dua Yong Rew
5436
Dua Yong Rew 2014.02.12 02:41  
hardcode the timeframe in your indicator?
Rogerio Figurelli
Moderator
40251
Rogerio Figurelli 2014.02.13 00:50  
In my opinion, if you choose Every Tick or OHLC optimizations, the timeframe parameter is not used, since you will be using M1 data. In this sense, just select Chart Time Frame input parameter of your EA will do what you want. Another point is that below this parameter, there is another named Expert Every Tick = false, that I think you must enable to your EA process ticks. So, I think timeframe is not the root cause of the initialization error.
Alain Verleyen
Moderator
31138
Alain Verleyen 2014.02.13 11:11  
gizbar_g:
...

Any feedback will be extremely appreciated.

This can work with a "standard" Expert Advisor, see this topic How to test a strategy for all timeframe.

But here you are using an EA generated with the Wizard, there are some limitations, in your case, the method Init of CExpert class impose a check on TimeFrame :

//--- returns false if the EA is initialized on a symbol/timeframe different from the current one
   if(symbol!=Symbol() || period!=Period())
     {
      printf(__FUNCTION__+": wrong symbol or timeframe (must be %s:%s)",symbol,EnumToString(period));
      return(false);
     }

So if you need an EA created with the Wizard to be run on any TimeFrame, you have to create your own class derived from CExpert and implementing your own initialization. However it's not a trivial task and I am not sure about the consequence to bypass this TimeFrame checking.

As a reference about backtesting and Strategy Tester, see the following topic ...

All (not yet) about Strategy Tester, Optimization and Cloud
All (not yet) about Strategy Tester, Optimization and Cloud
  • www.mql5.com
How ticks are generated : The Algorithm of Ticks’ Generation.
Alain Verleyen
Moderator
31138
Alain Verleyen 2014.02.13 11:16  
I forgot to mention that you can set your input parameter to PERIOD_CURRENT, then you can run your tests on different timeframe simply by changing the Strategy Tester period's combo box.
gizbar_g
13
gizbar_g 2014.02.15 12:20  
angevoyageur:
I forgot to mention that you can set your input parameter to PERIOD_CURRENT, then you can run your tests on different timeframe simply by changing the Strategy Tester period's combo box.

Thank you all for responding.

Problem solved after by passing this check

if(symbol!=Symbol() || period!=Period())

in CExpert as suggested by angevoyageur.

Thanks again to all for the help

Alain Verleyen
Moderator
31138
Alain Verleyen 2014.02.15 12:43  
gizbar_g:

Thank you all for responding.

Problem solved after by passing this check

if(symbol!=Symbol() || period!=Period())

in CExpert as suggested by angevoyageur.

Thanks again to all for the help

Did you modify CExpert directly ? I remember you that all classes in Standard Library can be updated on each new build of MT5, and don't have to be modified directly.
To add comments, please log in or register