mt5R icon indicating copy to clipboard operation
mt5R copied to clipboard

Server socket no created

Open Camilo-Mora opened this issue 3 years ago • 2 comments

I have had this issue before, and cannot recall how to fix so it will be good to leave a trial for the future. Basically, I have not been able to create a socket connection. I get this error in R, after the function Ping MT5.Ping() Error in base::socketConnection(host = "localhost", port = iPort, blocking = TRUE, : cannot open the connection In addition: Warning message: In base::socketConnection(host = "localhost", port = iPort, blocking = TRUE, : localhost:23456 cannot be opened [1] FALSE

Do you know how to fix it?

Camilo-Mora avatar Dec 18 '22 19:12 Camilo-Mora

This problem appears to be in MT5 when having more than two accounts set. I presume there is only one channel of communication between R and MT5. What worked in my case was :

  1. Remove the expert from MT5. It seems it gets stuck in the socket of the original account. For this, right click on the chart where the expert was loaded, click on "Experts List", select the MT5R expert and click "remove". Alternatively, delete the expert from the "Navigator" tab, and load it again.
  2. Log in into the trading account you want to use (In the Navigator tab).
  3. Right click on the MT5R expert (In the Navigator tab), and attach to chart.
  4. You may need to reboot MT5 .

This is an amazing package, but there is very little information on how to deal with different scenarios (like how to use when more than two accounts are active in MT5).

Camilo-Mora avatar Dec 21 '22 14:12 Camilo-Mora

Boa noite, Estou tendo um problema, será que poderia me ajudar. Consigo conectar mas logo desconecta e aparece essa msg: Error in if (server_resp == "") return(NULL) : argument is of length zero.

Valdsonmaia avatar May 03 '23 01:05 Valdsonmaia