How to optimise TF in strategy tester

 

Having to manually keep changing the TF in inputs (21 times) is very labour intensive

I know its possible having seen EA's with the option

But how to write the code ?

All help very much appreciated :)

Thank you in advance for your valuable time

 
input ENUM_TIMEFRAMES tf=PERIOD_D1;
Then use it everywhere you read the chart. What's the problem?
 

Respectfully, I want to be able to optimise the TF as shown in this EA

TF

 
Robert Jenkins #: Respectfully, I want to be able to optimise the TF as shown in this EA

Yes, and for that exact method, you have already been given the answer in the post just before this last one of yours ...

Forum on trading, automated trading systems and testing trading strategies

How to optimise TF in strategy tester

William Roeder, 2022.08.20 14:16

input ENUM_TIMEFRAMES tf=PERIOD_D1;
Then use it everywhere you read the chart. What's the problem?

 

Strewth ... Like getting blood out of a stone :(

I am obviously not being clear with my question

I want strategy tester to run all the variables whilst I sleep ... or whatever

My image is taken from an EA that DOES do that ... unfortunately the code is not available for viewing

 
Robert Jenkins #: Strewth ... Like getting blood out of a stone :( I am obviously not being clear with my question. I want strategy tester to run all the variables whilst I sleep ... or whatever

My image is taken from an EA that DOES do that ... unfortunately the code is not available for viewing

If the EA you are testing is closed source, and does not offer a Time-Frame input (as the example in your screenshot), then there is no normal way around it.

There may be an indirect method of calling the terminal from the command-line with different tester settings on each call, to run multiple tests, each with a different time-frame, but you will have collect the data and collate it externally from MetaTrader's Strategy Tester optimisations.

EDIT: By the way, in your original post you wrote and I quote "But how to write the code?", so we assumed you had the source code. But now you say "unfortunately the code is not available for viewing". So which is it?

Our original answer was based on your statement "But how to write the code?" , so we gave you code as an answer.

 
Robert Jenkins #: I want strategy tester to run all the variables whilst I sleep ... or whatever. My image is taken from an EA that DOES do that ... unfortunately the code is not available for viewing

If however, the EA you are testing is the very one in the screenshot, then what is the problem exactly?

Just set the start/stop/step for the time-frame and let it run the optimisations.

 
Robert Jenkins #:

Strewth ... Like getting blood out of a stone :( I am obviously not being clear with my question

My image is taken from an EA that DOES do that ... unfortunately the code is not available for viewing

You were unclear. Your question was about changing the timeframe; it was very clear. The answer given, twice, was modifying the code. You never stated you don't have code, until now.

What you want can not be done without code. Is that clear enough for you? Thanks for wasting everyone's time.

 

I give up :(

I have tried in plain English and I have tried with images

I am looking for the mql5 code to create the "Working Time Frame" line in the Set File

 
Robert Jenkins #:I give up :(. I have tried in plain English and I have tried with images.I am looking for the mql5 code to create the "Working Time Frame" line in the Set File

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 #:

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:

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

And how do I detect a new bar in this reference time frame? I use the following 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.

Thank you for your patience ... appreciated :)

The problem is ME not asking the right questions

Reason: