Download MetaTrader 5
To add comments, please log in or register
Does your signal already have a lot of of subscribers? It's time to think about the paid subscription!
Bruno Grilli
192
Bruno Grilli 2014.10.13 09:01 

Hi.

I have this piece of code exactly copied as is from MQL4 documentation:

 

   string cookie=NULL,headers;

   char post[],result[];

   int res;

//--- for working with server you need to add "https://www.google.com/finance" 

//--- to the list of the allowed URLs (Main menu->Tools->Options, "Expert Advisors" tab)

   string google_url="http://www.google.es";

   

//--- reset last error

   ResetLastError();

//--- load html page from Google Finance

   res = WebRequest("GET",google_url,cookie,NULL,50,post,0,result,headers);

//--- check errors

   if(res==-1)

     {

      Print("Error code =",GetLastError());

      //--- maybe the URL is not added, show message to add it

      MessageBox("Add address '"+google_url+"' in Expert Advisors tab of the Options window","Error",MB_ICONINFORMATION);

     }

 

Why is MT4 returning me an 4051 error code????

 

Thank you! 

Bruno Grilli
192
Bruno Grilli 2014.10.13 09:15  

Yes I do: Invalid function parameter value.

The point here is that both the function prototype and MQL4 documentation says the same, and I've copied the code into my EA (and I've put that address in the Tools => Options => EA section too, but I'm still getting that 4051 error...

 Any help, please? 

Carl Schreiber
5938
Carl Schreiber 2014.10.13 09:27  

Have you read in the Reference: "To be able to use the WebRequest function, you must add an URL to the list of allowed URLs in the "Expert Advisors" tab of the "Options" window." ?

Bruno Grilli
192
Bruno Grilli 2014.10.13 09:44  
Of course. That's what I've written in my previous post.
Carl Schreiber
5938
Carl Schreiber 2014.10.13 10:00  
have you tried another url like the one from the reference? One of the "parameter value(s)" must be wrong!
Bruno Grilli
192
Bruno Grilli 2014.10.13 10:04  

Yes, I have tried many urls... and nothing works. I'm checking the parameters and I've tried many other things without success...

By the way: I'm working behind a proxy (which is correctly configured in my MT4). Could this be the reason for the problem? 

Carl Schreiber
5938
Carl Schreiber 2014.10.13 10:36  

May be? Can you vary this configuration?

BTW I am using Windows-functions.

Bruno Grilli
192
Bruno Grilli 2014.10.13 11:11  

It is!!!!

I've run my code into a non-proxy Metatrader4 and it works!!!!

So I think we've got a bug here, havent' we?

gooly, how are you using those Windows-functions?

Thanks a lot! 

Carl Schreiber
5938
Carl Schreiber 2014.10.13 11:14  

hmm, google for "wininet.dll", InternetOpenW(..) mt4 mql4.

It should give you lots of examples.

Bruno Grilli
192
Bruno Grilli 2014.10.13 11:50  

Thank so much.

 I'll have a look. 

/
To add comments, please log in or register