Metatrader 5 Python Socket/Websocket communication 4014 error
Metatrader 5 Python Socket/Websocket communication 4014 error
Loading saved threads...
Paul Brink · External communityPost link
External question — Stack Overflow Stack Exchange
Author: Paul Brink
Original post: https://stackoverflow.com/questions/69843958
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am trying to create a communication interface between a python socket server and a Metatrader 5 Expert Advisor.
I've tried multiple approaches and tutorial's I found online for both sockets and websockets. All of these approaches yield the same problem.
Whenever I start a debug on live/historical data, I get a Socket creation error with code 4014. According to the error codes it is a "Function is not allowed for call" error.
Multiple sources recommended to allow web request from specified URL's. Ive done this as well for 127.0.0.1 and localhost. (Tools > options > Expert Advisors)
Why am I getting a function not allowed for call error, and how can this be fixed?
Expert code:
int socket=SocketCreate();
int OnInit()
{
if(SocketConnect(socket,"127.0.0.1",9090,1000))
{
Print("Connected to "," 127.0.0.1",":",9090);
}
else
{
Print(GetLastError());
}
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{
SocketClose(socket);
}
void OnTick()
{
SocketClose(socket);
}
Quote
Report
teslatrader · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: teslatrader
Original post: https://stackoverflow.com/a/74086501
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I faced the same problem.
Works for me: to point exactly '127.0.0.1' (without upper commas) in address input field.
Also, check your firewall settings - it may block your ports.
The best regards.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: Paul Brink Source score (net votes, not local likes): 1 Original post: https://stackoverflow.com/questions/69843958 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am trying to create a communication interface between a python socket server and a Metatrader 5 Expert Advisor. I've tried multiple approaches and tutorial's I found online for both sockets and websockets. All of these approaches yield the same problem. Whenever I start a debug on live/historical data, I get a Socket creation error with code 4014. According to the error codes it is a "Function is not allowed for call" error. Multiple sources recommended to allow web request from specified URL's. Ive done this as well for 127.0.0.1 and localhost. (Tools > options > Expert Advisors) Why am I getting a function not allowed for call error, and how can this be fixed? Expert code: int socket=SocketCreate(); int OnInit() { if(SocketConnect(socket,"127.0.0.1",9090,1000)) { Print("Connected to "," 127.0.0.1",":",9090); } else { Print(GetLastError()); } return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { SocketClose(socket); } void OnTick() { SocketClose(socket); }
Checking account access…