Hi
I am building a custom EA for MT5
When it is attached to a chart, the Socket Connection is made in OnInit() function & the connection is closed in OnDeinit() function while detaching the EA.
My code is:
I want that the new socket connection should get created if I update the timeframe of the chart while the EA is still attached to it.
However, if I update the timeframe of the chart while the EA is still attached to it, then it displays "Error in connecting to localhost:9090 Error : 5272" in the journal.
I am clueless about how to re-connect to the socket
Kindly help
Regards
if (reason!=REASON_CHARTCHANGE)
I replaced
void OnDeinit(const int reason) { //--- SocketClose(socket); ObjectsDeleteAll(ChartID(),-1,-1); }
by
void OnDeinit(const int reason) { //--- if (reason!=REASON_CHARTCHANGE) SocketClose(socket); ObjectsDeleteAll(ChartID(),-1,-1); }
However, the issue is still the same
I had the same error message. Below is what the error message means.
ERR_NETSOCKET_CANNOT_CONNECT | 5272 | Failed to connect to remote host |
I resolve the issue and it turned out to be a couple of things.
Firstly under tools > options > Expert advisor I needed to white list the doamin address. By clicking allow domin and then adding it. That still didn't resolve the issue. Next I needed to be sure I was using the correct port. I was using HTTPS so the port was 443. If I was using HTTP the ports probably 80. Then the connection worked and I got my next Bug lol. But this issue was resolved.
Hope this helps someone in the future and happy trading.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I am building a custom EA for MT5
When it is attached to a chart, the Socket Connection is made in OnInit() function & the connection is closed in OnDeinit() function while detaching the EA.
My code is:
I want that the new socket connection should get created if I update the timeframe of the chart while the EA is still attached to it.
However, if I update the timeframe of the chart while the EA is still attached to it, then it displays "Error in connecting to localhost:9090 Error : 5272" in the journal.
I am clueless about how to re-connect to the socket
Kindly help
Regards