Diagnostics
The bot didn't take the trade: reading the MT5 log
MetaTrader tells you exactly why an order failed. It just does it in a tab most traders never open, in the form of a four or five digit number. Learning six of those numbers turns an afternoon of guesswork into a thirty-second answer.
Two tabs, two different stories
The Toolbox has a Journal tab and an Experts tab. Journal is the terminal talking about itself: logins, disconnections, updates, orders accepted by the server. Experts is your EA talking: initialisation, its own print statements, and the result of every order it tried to send. When a trade is missing, start in Experts, then check Journal for the same timestamp to see whether the terminal was even connected.
The codes worth memorising
- 10016 — invalid stops. Your stop or target sits closer to price than the broker's minimum distance, or on the wrong side of it. Common on gold, where a stop that is fine on EURUSD is inside the allowed band.
- 10019 — no money. Free margin will not cover the requested volume. Usually a lot size that scales with balance meeting a drawdown, or another bot holding margin on the same account.
- 10014 — invalid volume. The lot is below the minimum, above the maximum, or not a multiple of the broker's step. A calculated 0.037 lot fails where 0.03 works.
- 10018 — market closed. Weekend, a holiday, or an instrument with different session hours than the one you tested on.
- 10027 — algo trading disabled by client. The terminal setting from the previous post, straight from the source.
- 10006 — request rejected. The broker declined it. If it repeats at the same time each day, ask support rather than editing the EA.
A rejected order writes a code. A filtered trade writes nothing at all. Silence is information too.
When there is no error at all
If the Experts tab shows initialisation and then nothing, the EA never attempted an order. That means one of its own conditions said no: a time filter, a spread filter, a maximum-positions limit, a news pause, a day-of-week setting. Most decent bots will print the reason if you enable their logging or verbose input. Turn it on for a day, read what it says, then turn it off so the file does not grow forever.
Turn on the numbers you will need later
Under Tools, Options, Expert Advisors, there is little to configure, but two habits pay for themselves. Keep the Experts log for at least a month, and take a screenshot of any unfamiliar code with the surrounding five lines. Codes on their own are ambiguous. Codes with a timestamp, a symbol and a lot size are diagnosable.
What to send when you ask for help
Account number, broker and server name, the exact symbol from the chart title, the last twenty lines of the Experts tab, and the EA's input list. With those five things a problem is usually solved in one message instead of ten.Logs on a VPS
The files live under the terminal's data folder, in MQL5/Logs for EA output and Logs for the terminal. Open the data folder from File, then Open Data Folder — do not go looking in Program Files, because the running copy is almost never there. On a VPS, copy the day's log out before you restart anything; a fresh session makes the evidence harder to find.
The habit
Read the log on a normal day, not only on a bad one. You learn what healthy output looks like for your bot, and the first line that does not belong becomes obvious instead of alarming.
Stuck on an error code? Send the log lines over.
Message on WhatsApp