Skip to main content

MetaTrader5 for linux users

Project description

MetaTrader 5 for linux system

A simple package that use wine, rpyc and a Python Windows version to allow using MetaTrader5 on Linux.

Install

  1. Install Wine.

  2. Install Python for Windows on Linux with the help of Wine.

  3. Find the path to python.exe.

    • I installed on /home/user/.wine/drive_c/users/user/Local Settings/Application Data/Programs/Python/Python39.
  4. Install mt5 library on your Windows Python version.

pip install MetaTrader5
pip install --upgrade MetaTrader5
  1. Install this package on your Linux Python version:
pip install mt5linux

How To Use

Follow the steps:

  1. Open MetaTrader5.

  2. On a terminal start the server:

python -m mt5linux <path/to/python.exe>
  1. On your script/notebook:
# import the package
from mt5linux import MetaTrader5
# connecto to the server
mt5 = MetaTrader5(
    # host = 'localhost' (default)
    # port = 18812       (default)
) 
# use as you learned from: https://www.mql5.com/en/docs/integration/python_metatrader5/
mt5.initialize()
mt5.terminal_info()
mt5.copy_rates_from_pos('VALE3',mt5.TIMEFRAME_M1,0,1000)
# ...
# don't forget to shutdown
mt5.shutdown()
  1. Be happy!

On step 2 you can provide the port, host, executable, etc... just type python -m mt5linux --help.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mt5linux-0.1.9.tar.gz (61.8 kB view hashes)

Uploaded Source

Built Distribution

mt5linux-0.1.9-py3-none-any.whl (31.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page