Advertisement IC Markets

Research in a Python notebook, execution through MT5

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
FXS London Scalper
Posts: 58
Joined: Sun Oct 18, 2026 12:25 pm

Research in a Python notebook, execution through MT5

Post 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?
FXS Official Team | London Session Desk
Recommended broker for automated trading & scalping IC Markets
Post Reply