I have an EA which regularly reports the status of an account to a web service. This has worked fine for years on MT4 and I have recently written an MT5 version which has also worked fine for several months on one MT5 account (BlackBull Markets) - and still is! However I have now put it on another account (ActivTrades) where it works 'occasionally'! By this I mean that the web requests sometimes send the data ok, but frequently get an HTTP error which is reported as "error 1001". I can't find any definition of an HTTP code 1001 can anyone help please? Is this some MQL5 specific code maybe?
For information, here is the web request function and below is a typical error response...
string httpGet(string url)
string cookie = NULL;
//--- Reset the last error code
//--- Timeout below 1000 (1 sec.) is not enough for slow Internet connection
int timeout = 5000;
res = WebRequest("GET", url, cookie, NULL, timeout, post, 0, result, headers);
//--- Checking errors
if(res == -1)
writeToLog(StringFormat("Error in WebRequest. Error code = %i, url = %s", GetLastError(), url));
else if (res == 200)
// Success, return result as a string...
writeToLog(StringFormat("WebRequest to %s failed. Error code = %i", url, res));
Error 1001 is an internal MQL WebRequest error (I got this information from MQ developer), it means :
1001 - SOCKET_HTTP_NO_CONNECTIONSo for some reason your server refuse the connection. Maybe a DDos protection ?
Ah, many thanks. It's odd that some calls get through (and other terminals on the same VPS work fine in this respect) - oh well!
Rewrote it to use "wininet.dll" instead of the MQL5 web methods and it's now working fine! Of course it means it can't be used on an MQL5 hosted terminal but I'm not anyway.
Thanks again Alain.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.