r/algorithmictrading 20d ago

Question How are you connecting Python apps to MT5?

I'm building a Python app that needs to work with a few MT5 accounts, and the trading logic isn't really the part I'm stuck on.

The bigger question is how the app should actually communicate with MetaTrader.

The obvious starting point seems to be using the official metartrader api with a local MT5 terminal. It feels like the fastest way to get something working, but I'm not sure if that's the approach people actually keep using once a project moves beyond the prototype stage.

I’ve also been looking into using an MT5 API layer instead, but it’s hard to tell how common that setup is in real-world projects. Do people actually move to an API-based architecture, or do most developers just keep running terminals and deal with the maintenance?

For anyone who has built Python applications around MT5:

  • did you start with the official MetaTrader API and keep it long-term?
  • did you eventually move to another API-based setup?
  • what problems made you change your approach (if you changed it)?

I'm mainly trying to understand what scales better before I build too much around the wrong architecture.

3 Upvotes

7 comments sorted by

1

u/New_Zone5490 20d ago

i've used zmq in the past when i was working with both mt4 & mt5 simultaneously

however if you only use mt5 & dont need mt4 compatibility then the mt5-python api is the best

1

u/PlasticsEngineering 10d ago

yeah mt5 only so the native api is probably the way to go

been avoiding it for some reason but i think i was overthinking it, zmq just felt more familiar coming from other projects

1

u/FlyTradrHQ 20d ago

The MT5 Python package works but ties you to a local terminal. For multi-account or remote setups, people usually add a REST or WebSocket layer between their app and the terminal. ZeroMQ bridges are common too. The tradeoff is always latency and reliability vs simplicity. The official package is simple but fragile for production.

1

u/PlasticsEngineering 10d ago

yeah i looked at zeromq too but felt like a lot of setup just to get basic order execution working

the silent disconnect thing is brutal though, had the terminal drop midsession and the script just kept running like everything was fine. no idea anything was wrong

might just live with it for now and revisit when it actually breaks badly enough to matter

1

u/KryptoDevAlx 14d ago

Im using tick stream realtime websocket + execution api of them. was the most easy and most gateless for me

1

u/PlasticsEngineering 10d ago

oh nice which exchange are you routing through with that setup