Enivid

Administrator
Staff member
Nov 30, 2008
18,535
1,355
144
Odesa
www.earnforex.com
A new build of MetaTrader 5 platform has been released on January 15 - Build 2755. It has now become available for download from brokers' trading servers. It focuses on major interface improvements:
  • Improved the Popup Prices window that displays information similar to that in the Market Watch but in a separate window. You can now switch to multi-column mode and control what information is shown there.
  • Added display of deals to the synthetic instruments' tick charts.
  • Fixed errors in calculations of option Greeks.
  • Improved platform's operation in Wine.
  • Added chart events for the release of the right mouse button and the mouse wheel key.
  • Fixed Sleep() function operation error that would cause incorrect wait times.
  • Revamped debugger interface in MetaEditor.
  • Fixed a bug that could cause MetaEditor to freeze when opening some projects.
MetaQuotes' forum announcement thread:
https://www.mql5.com/en/forum/360211

If you find a bug or some undocumented feature in the new build, please post about it here.
 

9nix6

Trader
Feb 25, 2021
3
1
8
51
www.az-invest.eu
There is a serious bug in the latest version of the CustomRatesUpdates function of MQL5. Actually, the bug has been around for quite some time. Some developers tested all of the previous versions between 2755-2784 (pus all of the latest beta releases).

Here is my sample code that will cause the bug to surface. It can be used as a test harness by the developers of MT5.

MQL5:
static string _CustomSymbol = "Custom"+_Symbol;
 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   ResetLastError();
 
   if(!CustomSymbolCreate(_CustomSymbol, "", _Symbol))
   {
      Print("Failed creating custom chart, error #"+(string)GetLastError());
      ResetLastError();
   }
   else
   {
      Print("Created "+_CustomSymbol+" chart");   
   }
 
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
 
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   MqlRates ratesArr[];
 
   if(CopyRates(_Symbol, PERIOD_M1, 0, 1, ratesArr) == -1)
   {
      Print("Error on CopyRates #"+(string)GetLastError());
      ResetLastError();
   }
   else
   {
      if(CustomRatesUpdate(_CustomSymbol, ratesArr) == -1)
      {
         Print("Error on CustomRatesUpdate #"+(string)GetLastError());
         ResetLastError();
 
         // this error surfaces when a new day starts
         // Error on CustomRatesUpdate #5304
         // 5304 -> A custom symbol with the same name already exists
         // or
         // Error on CustomRatesUpdate #0
 
         // Messages in the Journal
         // HistoryCache        'CustomSymbol' invalid container header [2]
         // HistoryBase 'CustomSymbol' invalid container (1970.01.01) found (off: 2683897016, size: 86589, file: 6978951150)
 
      }
   }
}

The undocumented errors that will pop up in the Journal, causing the entire history to vanish are:

HistoryCache 'CustomENQH21' invalid container header [3]
HistoryBase 'CustomENQH21' invalid container (1970.01.01) found (off: 883540262, size: 38469, file: 5178546525)

To replicate the problem, you need to:
  1. Attach the EA to 5 or more symbols
  2. Let it run for several hours before the server date changes.
  3. The error will trigger, sooner or later. Always around the same time (server time going from one day to the next).
It would be nice if the developers took some time to go over this.
 
  • 👍
Reactions: Enivid

9nix6

Trader
Feb 25, 2021
3
1
8
51
www.az-invest.eu
Build 2815 still has the same issue:

2021.03.01 23:00:02.682 HistoryCache 'GBPUSD.custom' invalid container header [3] 2021.03.01 23:00:02.682 HistoryBase 'GBPUSD.custom' invalid container (1970.01.01) found (off: 1628771737, size: 336789, file: 23103945255)