How to include timeframes in the optimization?

 
... or should I run optiizations on every timeframe? Thank You. 
 

Just have an input option to set the time-frame, and use that variable when you access OHLC data and Indicator buffers. Then you can include that input as part of the optimisations.

 

Forum on trading, automated trading systems and testing trading strategies

How to optimise TF in strategy tester

Fernando Carreiro, 2022.08.27 13:10

So, lets see if we can figure out what it is you are trying to ask. Take us step by step, image by image, what you are trying to achieve and what it is you are trying to find out.

Here is my understanding so far:

You have shown a screenshot of an EA that DOES optimise on time-frame (and here is one of mine):
How did I achieve this? I use the following input in my MQL5:
input ENUM_TIMEFRAMES i_eReferenceTF = PERIOD_CURRENT; // Reference Time-frame

And how do I use this input to calculate the values of the moving average in my EA? Here is an example ...

m_hHandle = iMA( _Symbol, i_eReferenceTF, m_nPeriod, 0, m_eMethod, m_ePrice );

And how do I detect a new bar in this reference time frame? I use the following code ...

void OnTick(void)
{
   static datetime dtBarCurrent  = WRONG_VALUE;
          datetime dtBarPrevious = dtBarCurrent;
                   dtBarCurrent  = iTime( _Symbol, i_eReferenceTF, 0 );
          bool     bBarNew       = ( dtBarCurrent != dtBarPrevious );


   if( bBarNew ) // Check for a New Bar and process the data
   {
      // other code ...
   };
};

And how do I optimise on it? I first I enable optimisation in my settings ...


Then I set the values I want to use for the optimisation, and run the optimisations.

Was my understanding of your question correct?

If yes, then we have already given you the answer several times.

If not, then please explain it differently, step by step, and with as much information as possible.

 
Fernando Carreiro #:

Yes, thank you.