New MetaTrader 5 platform build 1930: Floating window charts and .Net libraries in MQL5 - page 5

 

Hi Aytugan,

after apply last build update 1931 this morning, all my custom EAs stopped to work. It seems that "#Trade/SymbolInfo.mqh" fails, all object methods are returning empty data. Per example, I've build a blank expert to show you the evidences:

Result

Please, how could I revert to a previous working version? Do you have a older build executable available?

Thanks in advance,

LopTrader

 
lopTraderFx:
SymbolInfoTick("", Tick); // false
 

Error in WebRequest() function.

Tested with the MT5 V5.00 build 1931 under Windows 10.

I'm using WebRequest() function to send and get information to/from my web server. In some cases my server answers the requisistion with a message and return the code 201. But inside, the WebRequest() function is treating the code 201 as an error and is clearing the content of the message.

In other words, this code:

ResetLastError();
res = WebRequest("POST", SERVER_URL, cookie, NULL, timeout, post, 0, arrAnswer, headers);
mtError = GetLastError();
Is returning:
  • res = 201, note that 201 is not an error;
  • mtError = 5203, "HTTP request failed";
  • arrAnswer = NULL.

I think "arrAnswer" should never be cleaned, even with error status. Also, all class of status code 2xx should be treated as successful status, or at least the codes 200, 201 and 202 that are obvious.

I alread pointed this issue in https://www.mql5.com/en/forum/275054 with no responses.

Bug in WebRequest function - MT5 build 1881
Bug in WebRequest function - MT5 build 1881
  • 2018.08.22
  • www.mql5.com
Hello, The objective of this topic is to communicate a bug to MetaQuotes, I sent it to tickets system, but there is no tickets system anymore...
 
fxsaber:

CustomTicksAdd() is working like a charm! :)

Thank you!!!

 

After some experimentation I have a minimal example of the following:

  • Code compiled pre 1930 (e.g. MetaEditor build 1881)
  • .ex5 crashes on MT5 build 1931
  • Works if the code is recompiled with build 1931

#property version   "1.00"
#property strict
#property indicator_chart_window

#define OBJ_BASE_NAME            "Test"

int OnInit()
{
   return INIT_SUCCEEDED;
}

void OnDeinit(const int reason)
{
   ObjectsDeleteAll(0, OBJ_BASE_NAME);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   Update();
   return(rates_total);
}


void Update()
{
   string strTest;
   StringConcatenate(strTest, StringFormat("%02i", 1234), StringFormat("%02i", 5678));
}

To reproduce: 

  • Compile the above code using a version of MT5/MetaEditor pre 1930
  • Attach the .ex5 indicator to a chart in build 1931
  • Remove the indicator, or close the chart
  • An access violation is recorded in the Experts log

This looks like complex memory corruption, probably related to the string handling - and I would suspect that it is caused by the "optimizations" mentioned in the description of build 1930.

For example, the code does not seem to crash if any of the following is altered:

  • ObjectsDeleteAll(0, OBJ_BASE_NAME) is changed to the equivalent ObjectsDeleteAll(0, "Test")
  • The contents of the Update() function is moved inline into OnCalculate()
  • strTest is explicitly initialized, i.e. the declaration is changed to  string strTest = "";
 
lopTraderFx:

Hi Aytugan,

after apply last build update 1931 this morning, all my custom EAs stopped to work. It seems that "#Trade/SymbolInfo.mqh" fails, all object methods are returning empty data. Per example, I've build a blank expert to show you the evidences:


Please, how could I revert to a previous working version? Do you have a older build executable available?

Thanks in advance,

LopTrader

Hi Aytugan again,

for some reason, now "SymbolInfo.mqh" class needs to set "symbol name" property using method mSymbol.Name(Symbol()) before any call to Ask, Bid, ... methods. I've updated all my experts with that fix and now it seems it works. 

Otherwise, I can see a "leaked string left" warning on my terminal after every processed test (I hope this is just a warning).

Thanks!

lopTraderFx

 

The new build 1932 just fixed all issues I had previously (build 1931) with memory access violation errors and strings that were not cleaned up properly. For now -- testing this build for 20min -- no issues observed with my 180 EAs running on different instances.

Hope this works for all of you too folks.

 

After upgrading to 1930, 1931 and 1932 my pivot levels (trendlines) disappear in a small M1 chart. They reappear if the chart is larger.


 
Ivan Petkow:

Hope this works for all of you too folks.

Doesn't fix my example above - but I doubt that there are all that many real-life examples where there's a problem recompiling existing code for >= 1930.

 

Build 1932 Access violation!

I have some EAs compiled in build 1881 and all of then are crashing.

I'm not sure if the crash happens when "printf" is executaded or "WebRequest", I'm still investigating.

After the crash, the EAs still working.