I also encountered the same problem
I don't think that will be possible. As far as I know, the Python API cannot connect across the network, only on the same machine (it uses named pipes).
Most probably that port is binded to localhost so it can only be accessed from local machine.
You may try to forward that port using socat.
Actually this is possible. There is a Python library called mt5linux that implements a RPyC server to allow calling local Metatrader Python functions from remote.
Library name does not describe what it can do as it may run in windows too.
I'm developing a docker image that runs MetaTrader5 and mt5linux server on a container, exposing rpyc port so that a Python script may be run from anywhere.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have MetaTrader5 running on Wine on Arch Linux and can connect to it just fine from that machine using the following python script:
However, I want to be able to run my script on a Windows 10 machine on the same network but still connect to the MetaTrader5 instance on the Arch Linux server. I attempted this little code:
If I run this on Windows 10 it gives this error:
According to the docs, on Windows you connect as so:
import MetaTrader5 as mt5
And then you can just do the:
Whereas on Linux you have to run a server that listens on port 18812 and then do this:
So when I'm on Windows and attempt to connect it throws the error above. Is there a way on Windows to connect to a remote MetaTrader5 instance?