Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server socket no created #21

Open
Camilo-Mora opened this issue Dec 18, 2022 · 2 comments
Open

Server socket no created #21

Camilo-Mora opened this issue Dec 18, 2022 · 2 comments

Comments

@Camilo-Mora
Copy link

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
Copy link
Author

Camilo-Mora commented Dec 21, 2022

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).

@Valdsonmaia
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants