Error in Strategy Tester: cannot load indicator 'MACD' in Periods H1, H2, H3, H4, H6, H8, H12, D1

To add comments, please log in or register
Waldorf Bray Silva Cubas
198
Waldorf Bray Silva Cubas  

Hello Everyone,

I am developing my EA in Metatrader 5 and have an error in strategy tester in the line:

iMACD_Handle=iMACD("USDJPY",PERIOD_H1,20,60,6,PRICE_CLOSE);

The strateg tester show the error:

cannot load indicator 'MACD' [4805]

Error= 4805 Error applying an indicator to chart

iMACD_Handle=INVALID_HANDLE, USDJPY/H1,

The strategy tester can load indicator MACD in Periods: M1, M5, M15 and M30,

but cannot load indicator MACD in Periods: H1, H2, H3, H4, H6, H8, H12, D1.

The strategy tester visualization only show the charts for periods: M1, M5, M15 and M30.

Can you help me to solve the problem?


Vladimir Karputov
Moderator
205890
Vladimir Karputov  
Waldor Bray Silva Cubas:

Hello Everyone,

I am developing my EA in Metatrader 5 and have an error in strategy tester in the line:

iMACD_Handle=iMACD("USDJPY",PERIOD_H1,20,60,6,PRICE_CLOSE);

The strateg tester show the error:

cannot load indicator 'MACD' [4805]

Error= 4805 Error applying an indicator to chart

iMACD_Handle=INVALID_HANDLE, USDJPY/H1,

The strategy tester can load indicator MACD in Periods: M1, M5, M15 and M30,

but cannot load indicator MACD in Periods: H1, H2, H3, H4, H6, H8, H12, D1.

The strategy tester visualization only show the charts for periods: M1, M5, M15 and M30.

Can you help me to solve the problem?



Please enter your terminal information: restart the terminal and from the "Journal" tab copy the first three lines. It should be something like this:

Terminal        MetaTrader 5 x64 build 1595 started (MetaQuotes Software Corp.)
Terminal        Windows 10 Pro (x64 based PC), IE 11.00, UAC, Intel Core i3-3120M  @ 2.50GHz, RAM: 4444 / 8077 Mb, HDD: 332121 / 475588 Mb, GMT+02:00
Terminal        C:\Users\barab\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075

How many bars are there in the chrts settings? (Tools - Options - Charts - Max bar in chart).

What timeframe do you run your code on?

Waldorf Bray Silva Cubas
198
Waldorf Bray Silva Cubas  
Vladimir Karputov:


Please enter your terminal information: restart the terminal and from the "Journal" tab copy the first three lines. It should be something like this:

How many bars are there in the chrts settings? (Tools - Options - Charts - Max bar in chart).

What timeframe do you run your code on?


Hello, the Journal show the information:

Terminal MetaTrader 5 x64 build 1596 started (MetaQuotes Software Corp.)

Terminal Windows 8.1 Pro (x64 based PC), IE 11.00, UAC, Intel Pentium Dual  E2180 @ 2.00GHz, RAM: 1886 / 4085 Mb, HDD: 10535 / 92770 Mb, GMT-05:00

Terminal C:\Users\Polux\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075


The setting for Max bars in chart=Unlimited

The EA run in timeframe M1.


The strategy tester can load indicator MACD in Periods: M1, M5, M15 and M30,

but cannot load indicator MACD in Periods: H1, H2, H3, H4, H6, H8, H12, D1.

The strategy tester visualization only show the charts for periods: M1, M5, M15 and M30.

Can you help me to solve the problem?





Vladimir Karputov
Moderator
205890
Vladimir Karputov  

Please show screenshots Strategy Tester Tabs "Setings", "Inputs".

Show your MQL5-code.

Waldorf Bray Silva Cubas
198
Waldorf Bray Silva Cubas  
Vladimir Karputov:

Please show screenshots Strategy Tester Tabs "Setings", "Inputs".

Show your MQL5-code.


Hello, I attach the Strategy Tester Settings and the code of Expert Advisor.

Please review the code and run the EA in Strategy Tester.

Tell me why Metatrader 5 cannot create MACD Handle for Timeframes: H1, H2, H3, H4, H6, H8, H12, D1. 

Vladimir Karputov
Moderator
205890
Vladimir Karputov  

Here is my code:

//+------------------------------------------------------------------+
//|                                                         Test.mq5 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   ENUM_TIMEFRAMES TF[]=
     {
      PERIOD_M1,PERIOD_M5,PERIOD_M15,PERIOD_M30,PERIOD_H1,
      PERIOD_H2,PERIOD_H3,PERIOD_H4,PERIOD_H6,PERIOD_H8,
      PERIOD_H12,PERIOD_D1
     };

   int iMACD_Handle[12];

   for(int i=0;i<12;i++)
     {
      ResetLastError();
      iMACD_Handle[i]=iMACD(Symbol(),TF[i],20,60,6,PRICE_CLOSE);
      if(iMACD_Handle[i]==INVALID_HANDLE)
        {
         PrintFormat("iMACD_Handle==INVALID_HANDLE, Symbol=%s, TimeFrame=%s, Error=%d %s",
                     Symbol(),EnumToString(TF[i]),IntegerToString(GetLastError()));
        }
     };
   Print("OnInit INIT_SUCCEEDED!");
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---

  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---

  }
//+------------------------------------------------------------------+

Biuld my terminal:

Terminal        MetaTrader 5 x64 build 1596 started (MetaQuotes Software Corp.)
Terminal        Windows 10 Pro (x64 based PC), IE 11.00, UAC, Intel Core i3-3120M  @ 2.50GHz, RAM: 4257 / 8077 Mb, HDD: 333671 / 475588 Mb, GMT+02:00
Terminal        C:\Users\barab\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075

Everything works fine and not a single error.

Waldorf Bray Silva Cubas
198
Waldorf Bray Silva Cubas  
Vladimir Karputov:

Aquí está mi código:

Biuld mi terminal:

Todo funciona bien y ni un solo error.


Ok Thanks,

I going to use the code to solve the problem.

ENUM_TIMEFRAMES TF [] =
     {
      PERIOD_M1 , PERIOD_M5 , PERIOD_M15 , PERIOD_M30 , PERIOD_H1 ,
       PERIOD_H2 , PERIOD_H3 , PERIOD_H4 , PERIOD_H6 , PERIOD_H8 ,
       PERIOD_H12 , PERIOD_D1
     };
To add comments, please log in or register