Page 1 of 1

Research in a Python notebook, execution through MT5

Posted: Mon Oct 19, 2026 7:03 pm
by FXS London Scalper
A popular workflow: do research in Python (pandas, numpy, backtesting libraries) and execute through MT5 using the official MetaTrader5 Python package or a bridge.

What works well:
- Python for data analysis, feature engineering and backtesting.
- MT5 for order execution, position management and broker connectivity.
- The MetaTrader5 package for pulling history and sending orders from Python.

Pitfalls:
- The Python package requires the MT5 terminal running on the same Windows machine.
- Latency between Python decision and MT5 execution can be higher than a native EA.
- Error handling: network drops, terminal restarts and rejected orders need solid code.
- Research and live code diverge. The backtest uses one function, the live bot a slightly different one.

Advice from people who've done this:
- Share code between research and live wherever possible.
- Log every decision and order with timestamps.
- Run in paper mode for weeks before going live.
- Keep the MT5 side simple. Let Python handle logic, MT5 only executes.

Anyone running this setup in production? How do you handle terminal restarts?