Windows · MetaTrader 5

MT5 Trend Bot

A multi-symbol trend-following bot for MetaTrader 5. It watches EURUSD and GBPUSD on the hourly chart, takes trades only when several filters agree, and manages every position with a trailing stop and hard drawdown limits.

Read this before you do anything else.

This is educational software. Forex trading carries a significant risk of loss, and backtested performance does not predict future results. The bot ships in paper mode and refuses to attach to a real-money account until you explicitly change that. Leave it in paper mode and forward-test on a demo account for a meaningful stretch of live market conditions before you even consider real capital. Nothing here is financial advice.

1What you need

Three things, and the second one catches people out most often.

Windows Any recent Windows that runs MetaTrader 5. A Windows VPS is the usual choice if you want the bot running around the clock.
MetaTrader 5 The actual MT5 terminal, installed and logged into an account. The bot is a client that drives your terminal — it is not a broker connection of its own and cannot trade without one. Get it from your broker (preferred, since their build knows their servers) or from metatrader5.com.
An account A demo account to start with. You need the login number, password and server name your broker gave you.
On a Windows-on-ARM machine, the packaged app still works.

The released mt5bot.exe is a 64-bit Intel build and runs under emulation on ARM64 Windows. You only need to care about architecture if you build from source — see Building from source.

2Install

The release is a single executable. There is nothing to install and no folder to keep alongside it.

  1. Download the release

    Get the latest mt5bot-*-windows.zip from the releases page and extract it somewhere permanent — the bot runs from wherever you put it.

  2. Check it downloaded intact

    Each release ships a matching SHA256 file. Compare it against the archive:

    certutil -hashfile mt5bot-<version>-windows.zip SHA256

    The value should match the one in the release's .sha256.txt.

  3. Run it

    Double-click mt5bot.exe. The manager window opens — this is where everything is configured. Windows may warn that the publisher is unknown, because the executable is not code-signed; that is expected for this build.

3First-time setup

Everything below is set inside the manager. Your settings are stored in the Windows app data folder, so they survive restarts and upgrades.

  1. Connect it to MetaTrader 5

    Fill in your login, password and server exactly as your broker supplied them. Leave the terminal path blank unless you have several MT5 terminals installed — blank means auto-detect, which is what you want. If you do need it, the file to point at is terminal64.exe.

  2. Choose your pairs

    The default is EURUSD,GBPUSD. These are the two the strategy was validated on. USDJPY was deliberately dropped after testing showed it underperformed structurally.

  3. Set up alerts (optional)

    Telegram needs a bot token and chat ID; email needs an SMTP user, password and recipient. Both are optional, and the bot trades identically without them — you simply will not hear about it until you check the journal.

  4. Run the connectivity checks

    The Startup Health panel verifies MT5, your symbols, Telegram and SMTP, and shows each as green or red. Get everything green before you start trading. If email alerts are on, this also performs a real SMTP login, so a wrong password fails here rather than silently at the first alert.

  5. Start

    Press Start. The Activity Console streams what the bot is doing; the verbose toggle adds detailed per-loop diagnostics when you want to see the reasoning behind a decision.

4Paper mode and live mode

This is the single most important setting in the application.

Paper
(default)
A forward test. The bot runs the full strategy against live market data and records every trade it would have taken to journal/paper-trades.csv. It will refuse to start if the account it is pointed at is a real-money one, so paper mode cannot quietly become live trading by accident.
Live Real orders, real money. You must set this deliberately. Anything unset or unrecognised means paper — the safe direction.
Forward-test before going live.

A backtest tells you how a strategy behaved on data it has already seen. Paper mode tells you how it behaves on data nobody has seen yet, including how your broker's spreads and execution treat it. Those are different questions, and only the second one predicts anything.

5How it decides to trade

A trend-following strategy on the hourly chart. Several conditions must agree before it enters, which means it trades infrequently by design.

Entry triggerEMA(20) crosses EMA(100)
Trend filterPrice must be on the correct side of EMA(200)
Momentum filterRSI(14) between 45–75 for longs, 25–55 for shorts
Volatility floorATR(14) at least 0.04% of price, which filters out dead and choppy markets
Session filterOnly the high-liquidity London/New York overlap, 07:00–20:00 GMT
News blackoutNo entries within ±30 minutes of a high-impact release, read from the MT5 economic calendar
Stop loss2.5 × ATR, so it adapts to current volatility rather than a fixed pip distance
Take profitNone. Exits are managed entirely by the trailing stop, which is what lets a strong trend run
Trade managementStop moves to break-even at +2.0 × ATR; trailing stop activates at 3.5 × ATR

If it seems to be doing nothing for long stretches, that is usually correct behaviour — most hours fail at least one of these filters.

6Risk controls

These run whether or not you are paying attention, and they are the reason the bot stops itself rather than trading through a bad run.

Per trade1% of account equity, sized from the stop distance rather than a fixed lot
Leverage capHard ceiling of 25×
Daily circuit breakerStops trading for the day at −3%
Weekly circuit breakerStops trading for the week at −6%
Correlation guardAt most one open position across highly correlated pairs, so EURUSD and GBPUSD cannot double the same bet
Max holding periodForce-closes a position after 5 days rather than letting a dead trade tie up risk budget

7Running it day to day

Keeping it alive

The bot reconnects automatically when MT5 drops, retries initialisation instead of exiting on first failure, and sends an hourly heartbeat if you have alerts on. For unattended operation on a VPS, watchdog.bat restarts it if the process dies outright.

What it records

Closed trades are appended to a CSV journal — never overwritten — and logs rotate so they cannot fill the disk. On startup the bot backfills any trades that closed while it was down, and it re-syncs periodically (every 15 minutes by default) so the journal stays accurate even across a crash.

The daily digest

If email is configured, you get a daily summary covering every signal generated, which filter blocked the ones that were not taken, the current indicator state per pair, and realised performance — win rate, profit factor, expectancy and drawdown — over both the last 24 hours and a rolling 30 days. The blocked-signal list is the genuinely useful part: it shows you what the bot saw and chose to skip.

8Troubleshooting

I double-clicked the app and nothing happened at all.
The window genuinely never opened, rather than opening and closing? Check you extracted the archive first — running the executable from inside a zip viewer fails this way. If it still does nothing, download the release again and verify the SHA256; a truncated download behaves exactly like this.
The MT5 check is red.
Almost always one of three things: the MT5 terminal is not installed, it is installed but not logged in, or the login/server pair is wrong. Open MT5 itself and confirm you can see live prices there first — if MT5 cannot connect, the bot certainly cannot. Check the server name character for character; brokers often run several with near-identical names.
It is connected but never places a trade.
Usually correct behaviour. Entries need the EMA cross, the trend filter, the RSI band, the volatility floor, the trading session and the news blackout all to agree at once, which is uncommon. Turn on the verbose console to see which filter is rejecting each bar, and check the daily digest's blocked-signal list.
Can I run it on a Mac or Linux box?
Not for trading. MetaTrader 5's Python interface is Windows-only, with no macOS or Linux build in existence. The backtesting and validation tools do run everywhere, using downloaded price data instead of a live terminal.
Windows says the publisher is unknown.
The executable is not code-signed, so Windows SmartScreen warns about it. Verify the SHA256 against the release file, which tells you rather more about the file's integrity than a signature would.
Can I trust the backtest numbers?
Treat them as a sanity check, not a forecast. They model spread and commission and cover about two and a half years, and the project ships Monte Carlo, sensitivity and walk-forward tools specifically because a single backtest result is not evidence of much. Your own forward test on a demo account is worth more than all of them.

9Building from source

Only needed if you want to modify the bot. The released executable requires none of this.

From a clone of the repository, on Windows:

powershell -ExecutionPolicy Bypass -File .\install_windows.ps1 -Build

The build produces a single dist\mt5bot.exe — a onefile build, with no accompanying folder to copy alongside it.

That installs a suitable Python if the machine has none, creates the virtual environment, installs the MetaTrader 5 package, verifies it imports, and builds dist\mt5bot.exe.

The Python interpreter must be 64-bit Intel, even on an ARM machine.

MetaTrader 5 publishes win32 and win_amd64 wheels only — there has never been an ARM64 build. On Windows-on-ARM, winget installs the ARM64-native Python even when you explicitly ask for x64, and pip then reports no matching distribution for MetaTrader5, which reads like a broken version pin rather than the wrong interpreter. Install the amd64 build from python.org and let it run under emulation. The setup script handles all of this, and checks sysconfig.get_platform() rather than platform.machine(), because the latter reports the host CPU under emulation and so rejects an interpreter that is perfectly correct.