- Clone the repo and make sure Docker is installed.
- Edit the compose.yaml file by setting a value to MT5_HOST and VNC_PW environment variables. Leave the ports unchanged, otherwise update the new ones in start.sh script accordingly.
- Run
docker compose up -d. - Access your MT5 instance at http://MT5_HOST:6081/vnc.html, replacing MT5_HOST by the value assigned to it (localhost in most cases). Password to connect is the value set to VNC_PW.
- Proceed with the interactive installation of MT5. Don't change the default installation folder.
- A connection test is performed exclusively at container startup. Check the last container logs to see if connection test was successful. To establish the connection from your script, run:
# import the package
from pymt5linux import MetaTrader5
# establish the connection
# if running your script in the host machine:
mt5 = MetaTrader5(host="localhost", port=8001)
# if running your script in a separate container in the same docker network:
mt5 = MetaTrader5(host="mt5docker", port=8001)- Make sure you test with a DEMO account first, then have fun!
Most importantly, see MetaQuotes' official documentation.