Bug in MT4->MT5 adapter

Posted By: Zheka

Bug in MT4->MT5 adapter - 10/03/19 13:44

There is a bug in zmq4.mqh in overloading MQL5 functions for the existing MQL4 code base to work on MT5.
Code
#define DEFINE_TIMESERIE(NAME,FUNC,T)                                                                         \
  class CLASS##NAME                                                                                           \
  {                                                                                                           \
  public:                                                                                                     \
    static T Get(const string Symb,const int TimeFrame,const int iShift)                                      \
    {                                                                                                         \
      T tValue[];                                                                                             \
                                                                                                              \
      return((Copy##FUNC((Symb == NULL) ? _Symbol : Symb, [color:#CC33CC]_Period[/color],  iShift, 1, tValue) > 0) ? tValue[0] : -1); \
    }              
....
}

_Period refers to the timeframe/period on the chart that Zorro EA is applied to.

As a result, CMD_HISTORY calls return bars of the timeframe on the chart, rather than that specified by Zorro (which is PERIOD_M1), and that screws up internal Zorro bar construction\gives erroneous data for the Lookback period in Live.

The corrected line that works:
Code
return((Copy##FUNC((Symb == NULL) ? _Symbol : Symb, [color:#CC33CC]TFMigrate(TimeFrame)[/color], iShift, 1, tValue) > 0) ? tValue[0] : -1); 
Posted By: jcl

Re: Bug in MT4->MT5 adapter - 10/05/19 08:00

Thanks for the info! This will be fixed in the next update.
© 2024 lite-C Forums