MTF Strategy Testing

To add comments, please log in or register
Michael Green
415
Michael Green  

Hi,

Can someone please clarify the following.

I have developed an EA that runs on the 1 Hour chart. 

The EA has 5 components that it analysis's on the hour before making a trade decision. 4 of these components are based on the 1 hour time frame and 1 of these components is based on the 4 hour time frame.

If I run the strategy tester on the 1 hour time frame with all 5 components, I get different results from running the strategy tester on the 1 hour time frame with the 4 hour component removed.

Therefore I presume that using a forward 4 hour component on a strategy test on the 1 hour time frame provides accurate results.

I am asking this because I see from reading various discussions on this topic that Multi frame EAs do not work unless you use GlobalVariableGet for differing time frames to the screen your on.

So please clarify if the strategy test provides usable results for multi time frame EAs without the use of GlobalVariableGet ?

I look forward to hearing your comments.

Thanks in advance Mike.

Enrique Dangeroux
410
Enrique Dangeroux  
MT4 or MT5?
Michael Green
415
Michael Green  
Enrique Dangeroux:
MT4 or MT5?

mt4

whroeder1
17943
whroeder1  
  1. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors.
              Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum

  3. Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked. Are you using iBarShift?
              Don't mix apples and oranges.

  4. GlobalVariableGet is irrelevant to your question.
Michael Green
415
Michael Green  
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   double CCI_H4=0;
   if (iBars(NULL,PERIOD_H4)>14) CCI_H4 = iCCI(NULL,PERIOD_H4,14,PRICE_MEDIAN,1); 
   GlobalVariableSet("CCI_H4",CCI_H4);


I use the code above to call the data in the EA. The EA code is shown below:


 

void CheckForSignal()
  {
   double Cci=GlobalVariableGet("CCI_H4");
   static datetime candletime=0;
   if(candletime!=Time[0] && Cci!=0)
     {
      //---4 H Oscilator      
      //double Cci=iCCI(NULL,PERIOD_H4,14,PRICE_MEDIAN,1);
      //---1 Hour Trend
      //--- Ema 200
      double Ema1hr_200=iMA(NULL,PERIOD_H1,200,0,MODE_EMA,PRICE_MEDIAN,1);
      //---Price
      double Price=(High[1]+Low[1])/2;
      double PriceBack=(High[2]+Low[2])/2;
      //---Fibionacci MAs
      double Fib5H1=iMA(NULL,PERIOD_H1,5,0,MODE_EMA,PRICE_MEDIAN,1);
      double Fib8H1=iMA(NULL,PERIOD_H1,8,0,MODE_EMA,PRICE_MEDIAN,1);
      double Fib13H1=iMA(NULL,PERIOD_H1,13,0,MODE_EMA,PRICE_MEDIAN,1);
      //---Trigger Confirmation
      double MacdAdjustedH1=iMACD(NULL,PERIOD_H1,6,17,1,PRICE_MEDIAN,MODE_MAIN,1);
      double MacdAdjustedBackH1=iMACD(NULL,PERIOD_H1,6,17,1,PRICE_MEDIAN,MODE_MAIN,2);
      //---Sar
      double SarH1=iSAR(NULL,PERIOD_H1,0.07,0.2,1);
      double SarBackH1=iSAR(NULL,PERIOD_H1,0.07,0.2,2);

      //Did it make an up arrow on candle 1?

      if(Price>Ema1hr_200)
         if(Cci<100)
            if(Fib5H1>Fib8H1 && Fib8H1>Fib13H1)
               if(SarBackH1>SarH1 && SarH1<Price)
                  //---
                  if(MacdAdjustedH1>MacdAdjustedBackH1)


Though this does not really answer the question because when running the strategy test I run it like this:

 

//double Cci=GlobalVariableGet("CCI_H4");

   static datetime candletime=0;

   if(candletime!=Time[0] )

     {

      //---4 H Oscilator      

      double Cci=iCCI(NULL,PERIOD_H4,14,PRICE_MEDIAN,1);

and still get different results on the 4h usage or not ?? Therefore it must be having some effect??

Eleni Anna Branou
Moderator
6598
Eleni Anna Branou  

Please use the </> button to insert your code.


Michael Green
415
Michael Green  
Eleni Anna Branou:

Please use the </> button to insert your code.


Ok sorry will do next time thanks Eleni !

Can you bring light to the question?

Eleni Anna Branou
Moderator
6598
Eleni Anna Branou  
Michael Green:

Can you bring light to the question?

No, I am not a code and can't help you.

You can edit your previous post too and insert your code with the </> button.

Michael Green
415
Michael Green  
Eleni Anna Branou:

No, I am not a code and can't help you.

You can edit your previous post too and insert your code with the </> button.

I have updated the code portion does this help?

Eleni Anna Branou
Moderator
6598
Eleni Anna Branou  
Michael Green:

I have updated the code portion does this help?

It doesn't help you with your problem, but it helps all participants see your code better.

To add comments, please log in or register