The short answer
Build an MT5 Expert Advisor in MQL5 if your rules use price and indicators and you want MT5's Strategy Tester and the simplest setup on a VPS. Build a Python bot with the MetaTrader5 package if you need data analysis, machine learning, outside data or several brokers, and you're happy to backtest separately.
What is an Expert Advisor?
An Expert Advisor (EA) is a program written in MQL5, MetaTrader 5's own language, that runs inside the MT5 terminal on a chart. MT5 calls it on every new price tick, so it can check your rules and open, change or close trades immediately. Indicators and scripts are written in the same language.
What is a Python trading bot for MT5?
MetaQuotes publishes an official Python package, MetaTrader5 (pip install MetaTrader5). A Python program uses it to connect to an MT5 terminal running on the same Windows machine, read prices and history, and send orders. The logic lives in Python; MT5 handles the connection to the broker.
How do they compare?
| MT5 Expert Advisor (MQL5) | Python bot (MetaTrader5 package) | |
|---|---|---|
| Where it runs | Inside the MT5 terminal, on a chart | A separate program next to the MT5 terminal |
| Operating system | Wherever MT5 runs | Windows (the package needs a Windows MT5 terminal) |
| Reaction to prices | Called on every tick | Polls for new data, usually every second or less |
| Backtesting | Built in: MT5 Strategy Tester with visual mode and optimisation | Separate: test on exported history in Python |
| Data and libraries | MQL5 standard library and indicators | pandas, NumPy, scikit-learn, APIs, databases, spreadsheets |
| Multiple brokers or apps | One MT5 account per terminal | Can combine MT5 with other data sources, alerts or brokers |
| Running 24/5 | On a Windows VPS with MT5 open | Same, plus the Python program kept running |
When is an EA the better choice?
- Your rules use price, time and indicators (moving averages, RSI, ATR, breakouts).
- You want to backtest and optimise inside MT5's Strategy Tester.
- You trade one account and want the fewest moving parts on the VPS.
- You may sell or share the EA with other MT5 users.
When is Python the better choice?
- Your decisions need data analysis, statistics or machine learning.
- You use outside data: news, economic calendars, spreadsheets, a database.
- You want to send alerts to Telegram or email, or log everything to a dashboard.
- You already research in Python and want the same code to trade.
Can you use both?
Yes, and it's common: Python does the research and writes signals or levels to a file or database, and a small EA reads them and handles execution inside MT5, where trade management (stops, trailing, partial closes) reacts on every tick.
How do you keep a bot running?
- Rent a Windows VPS close to your broker's servers.
- Install MT5, log in, and enable algorithmic trading.
- Attach the EA to its chart, or start the Python program as a service that restarts itself.
- Add alerts for disconnections, errors and daily loss limits, so you know when something needs attention.
Questions people also ask
Is MQL5 hard to learn?
MQL5 looks like C++. Simple EAs are manageable for programmers, but order handling, broker rules and error cases take experience to get right.
Can the MetaTrader5 Python package run on Linux or a Mac?
Not directly; it needs a Windows MT5 terminal. People run it on Linux through Wine-based setups, but a Windows VPS is the simpler, more reliable choice.
Can I backtest a Python strategy in MT5's Strategy Tester?
No. The Strategy Tester runs MQL5 programs. Python strategies are backtested in Python on historical data, which you can export from MT5.
Do I get the source code?
When cobblewave builds an EA or bot for you, yes: you get the source code and the compiled files, and the rules stay yours.
Want us to build it?
This is what our mt5 trading bots service does. Tell us what you need and we'll reply within one working day with a clear quote.
This guide is about building software. cobblewave does not give investment advice, sell strategies or signals, or manage money. Automated trading can lose money quickly; test with small sizes first and follow your broker's and SEBI's current rules.
Have a question we didn't answer?
Ask us on WhatsApp or through the contact form. It's free.