What is a trading robot? How an expert advisor works in MT5
By Fernando Funicelli · Founder of Lucky Dogs Trading Systems

A trading robot is a program that buys and sells for you: in MetaTrader 5 it is called an Expert Advisor (EA), reads every price that arrives from the broker, checks its rules and sends the order without you clicking. Understanding how a trading robot works means understanding that cycle, and it fits on one page.
You know the scene. Gold sat still all day and decided to move at 3 a.m. The entry you had marked passed while you slept. Or you hesitated for two seconds and got in at the worst price of the move.
That is where the trading robot shows up, almost always as a curve going up in an ad. And that is where the problem lives: if you switch on a robot without knowing what it does inside, all you see is the curve. You don't know where the stop is, what happens when the computer shuts down, or why today's lot is bigger than yesterday's.
The sentence that sums up this guide: a trading robot doesn't guess the market: it repeats a rule, the same way, at every price. The rest shows what that rule is, what parts it is made of and what it needs to run.
What is a trading robot (and what is an Expert Advisor)?
Trading robot, Expert Advisor, EA, forex robot, trading bot: these are names for the same thing. It is a program with written rules for entry, exit and position size, which runs inside the platform and carries out those rules on its own, without asking for confirmation on each trade.
In MetaTrader 5, the official name is Expert Advisor, and the file you install has the .ex5 extension: the compiled program, ready to run. The source code, in .mq5, is the recipe written in the MQL5 language, and almost no seller hands it over. You get the robot, not the recipe.
| Platform | What it is called | File |
|---|---|---|
| MetaTrader 5 | Expert Advisor (EA) | .ex5 |
| MetaTrader 4 | Expert Advisor (EA) | .ex4 (doesn't run on MT5) |
| Other platforms and crypto exchanges | bot, robot, automated strategy | each has its own format |
A common mix-up is between a robot and an indicator. Both show up on the same chart, but they do different jobs: the indicator draws and alerts; the EA decides and executes. A moving average on the chart shows the trend and stops there. An EA that uses that average reads the value, compares it with the rule and opens the order.
Buying a robot is buying decisions made in advance: someone wrote down when to enter, how much to risk and when to exit, and the robot carries that out, trade after trade.
How a trading robot works in MT5, step by step
In most EAs, from the simplest to the most sophisticated, the cycle is the same. It starts every time a new price arrives and ends in one of two things: an order or waiting.
- A price arrives. The broker sends a new quote, the tick (each recorded price change). In gold's busy hours they arrive one after another.
- The EA reads the chart. Candles, indicators, time, spread and the positions it already has open.
- It checks the entry rule. If nothing matches, it waits for the next price. That is what a good EA does most of the time: wait.
- It calculates the lot. Fixed, by the risk you chose, or growing with the balance.
- It sends the order to the broker, with the stop and, if there is one, the target.
- It follows the position. It moves the stop and closes at the target, after a set time or on the exit rule.
- It logs everything in the terminal: the robot's messages go to the Experts tab and the account's events to the Journal tab, both in the Toolbox.

The point that matters is in step 3: the robot has no opinion about the market. Everything it will do in your account was already written in the rule before the first tick. Understanding a robot is reading that rule, part by part.
Where the robot runs: in your terminal, not at the broker
The EA runs inside the MetaTrader 5 that is open on your computer or on a VPS (a cloud computer that stays on 24 hours). It doesn't run at the broker. If the terminal closes, the robot stops deciding.
What stays at the broker is the order it already sent. And there are two ways to protect that position:
- Stop on the server. The stop goes along with the order and is kept at the broker. If your terminal shuts down, the position stays protected, because the server is what executes the stop.
- Stop executed by the EA. The robot itself follows the price and closes the position when the time comes. It works well, but it depends on the terminal being on and connected.

In both cases, only a running terminal lets the robot open new trades, move the stop and close on its rule. That is why people who take a robot seriously keep it running on a VPS. The installation, including the step that keeps the EA on 24 hours, is in how to install a robot (EA) in MT5.
The parts of an EA: entry, exit, lot and protection
From the outside, every robot looks the same: a name in the corner of the chart and a curve. On the inside, it is made of four parts. They decide the risk, and each one has a question you can ask before you switch it on.
| Part | What it decides | What to ask about it |
|---|---|---|
| Entry | when to open and on which side | does the rule wait for confirmation or enter on any move? |
| Exit | stop, target, time or exit rule | does every trade start with a stop? Is the stop on the server? |
| Lot | the size of each trade | is it fixed, set by risk, growing with the balance or multiplied after a loss? |
| Protection | what stops a bad day | is there a daily loss limit, a pause around news, a lot cap? |

The entry is the part everyone looks at, and the one that explains the result least on its own. Two very different entry rules can win or lose about the same, depending on what comes after.
The exit is where the robot protects what it has. The stop defines how much a trade can cost. The target defines when it cashes in. A time exit closes the position after a set period, winning or not.
The lot is the part that changes the risk the most, and the easiest to hide. There are three healthy ways to calculate it:
- fixed lot, always the same size;
- lot by risk, where the robot adjusts the size so the stop costs a chosen slice of the balance;
- lot that grows with the balance, which is compound interest on autopilot: each gain increases the next trade, and each loss shrinks it.
And there is the dangerous way: martingale, which multiplies the lot after each loss to recover everything at once. How that multiplication reaches the day the account can't take it, with the numbers, is in the martingale strategy: what it is and why it breaks.
Protection is the seat belt. A daily loss limit pauses the robot when the day goes badly. A pause around news avoids trading the announcement that moves the price in seconds. A lot cap keeps the position from going over a certain size, even with a big balance.
If you can ask a seller only one question, ask about the lot. It separates the robots that last from the ones that one day take the whole account.
Types of trading robot and how each one wins and loses
Robots are grouped by the way they try to win. Each type has a market where it does well and one where it struggles. None wins in all of them.
| Type | How it tries to win | Where it usually loses | What to look at |
|---|---|---|---|
| Trend and breakout | enters when the price confirms a move | in a sideways market, with several false entries | the stop and how many losing months in a row it had |
| Reversal | bets on the price coming back | when the move doesn't come back | whether every trade has a stop |
| Grid | opens several entries at levels and closes the group together | on the day the price doesn't come back | whether the grid has a stop and whether the lot multiplies |
| Martingale | doubles the lot after a loss | one long streak breaks the account | the volume of each trade in the report |
| Scalper | many short trades, small target | on the spread, slippage and news | the cost and the execution |
| News | trades the announcement | on a wide spread and slippage | whether the test used real ticks |
The types blend, and what defines the risk is still the table of parts, not the name of the style.
To go deeper on a style: grid trading and how it works, scalping gold and the 5 day trading setups for gold.
And if your question is already the next one, whether a robot of any of these types deserves your money, the answer is in the 15-minute test on MT5.
Automated or semi-automated trading robot: how much you decide
"Automated trading robot" and "semi-automated" tools get mixed up all the time, but they are not the same thing. The difference is who presses the button.
- Automated: the EA decides and executes everything, from entry to exit. You choose the setup and keep an eye on it. That is the subject of this guide.
- Semi-automated: the program suggests, prepares or opens, and you confirm, adjust or close. Order panels, assistants that calculate the lot and indicators with alerts belong here.
- Copying a signal: another person, or another person's robot, decides, and your account repeats each trade. No EA on your terminal decides anything. The full path is in copy trading: what it is and how it works.
Automated takes you away from the screen; semi-automated serves those who want to keep deciding, just faster.
Expert Advisor in MT5: where it comes from and where it shows up
An Expert Advisor reaches MT5 by three paths:
- The MQL5 Market, the store inside MetaTrader itself. You buy or rent, and the robot installs on your terminal.
- An .ex5 file from a seller, which you copy to the terminal's Experts folder.
- Your own code, written in MetaEditor, the editor that comes with MT5.
Once installed, it shows up in three places:
- in the Navigator, in the Expert Advisors folder;
- on the chart, with its name in the top corner and a hat icon, blue when it can trade;
- at the top of the terminal, in the Algo Trading button, which has to be green: it is the master switch that lets robots trade.
The step by step, with the windows, is in how to install a robot (EA) in MT5. For buying, see how to buy an EA on the MQL5 Market, with rental and activations. And the official MetaTrader 5 help on algorithmic trading explains each option in detail.
What a trading robot needs to run
- MetaTrader 5 on a computer. It runs on Windows, and you can also use it on a Mac and on Linux: see MetaTrader 5 on Mac and Linux. The phone app follows the account but doesn't run EAs.
- A broker account, demo or real, of the type the EA asks for. MT5 has two types: hedging, which allows several positions on the same asset at the same time, and netting, which merges everything into a single position per asset. A robot built for hedging may trade differently on a netting account.
- Leverage and margin that fit the lot. Leverage defines how much margin each position ties up. It doesn't change what the stop costs, but it can block the order if margin runs short: see what leverage changes, and what it doesn't.
- A balance that covers the minimum lot. The smallest lot the broker accepts is usually 0.01, and with it each price move has a fixed value in the account. With too small a balance, the robot can't cut the risk below that, and the profile you chose stops being in charge.
- The terminal on while there is a position to follow, preferably on a VPS.
Before you switch a robot on: where to check
You now know what a robot does on the inside. Before you put money in one, three reads complete the picture:
- The 5 numbers that separate a serious robot from a promise, along with the 7 warning signs.
- How to test a robot before you buy, in 5 steps, from the seller's page to the decision.
- How to backtest on MT5 with real ticks, so you can run the test yourself in the Strategy Tester.
Our gold EAs, side by side
Our EAs trade gold on MetaTrader 5, and each one answers the table of parts in its own way. The numbers come from the test with real ticks in the Strategy Tester:
- Collie Gold: trades short baskets, each one with a stop. It is a grid, but without martingale: the lot never multiplies. The stop is executed by the EA itself, so it asks for the terminal to be on, preferably on a VPS. It made +589% in 2025 on the Moderate profile, with 66 of 71 months in profit from January 2021 to November 23, 2026.
- Pitbull Gold: every trade starts with the stop and the target on the broker's server. No grid, no martingale, no averaging down. It made +884% in 2025 on the Balanced profile, with 21 of 22 months in profit in 2025 and 2026.
- Beagle Gold: the profile chooses how much a trade costs at the stop, from 1% to 5% of the balance, and the stop is on the server from the first second. It made +184% in 2025 on the Moderate profile, with 21 of 22 months in profit in 2025 and 2026.
- Doberman Gold: it only enters when its conditions line up, with the stop on the server from the first second; the profile sets each trade's reference risk, from 0.5% to 2.5% of the balance. It made +162% in 2025 on the Balanced profile, with 19 of 23 months in profit in 2025 and 2026 (November through the 8th). In the continuous Balanced test, from January 2023 to November 8, 2026, the largest drop was 32% on equity (with open positions) and 30% on balance (closed trades only).
- Cane Corso Gold: a portfolio of independent strategies on a single gold chart, each trade with its stop and target on the broker's server, no grid and no martingale; the profile sets the estimated cost of a trade at the stop, from 0.25% to 2% of the balance. It made +367% in 2025 on the Balanced profile, with 34 of 46 full months in profit, from January 2023 to November 14, 2026. In the continuous Balanced test, the largest drop was 41% on equity (40% on balance).
On all of them, the default lot grows with the balance, and choosing the profile is the whole setup: there is no set file to download. And each one has its own free demo, so you can run it in the Strategy Tester of your MetaTrader before you decide.
See our gold EAs side by side, with the free demo of each one.
Frequently asked questions
Are a trading robot and an Expert Advisor the same thing?
Yes. In MetaTrader 5, the trading robot is called an Expert Advisor, or EA. "Bot", "forex robot" and "automated trading system" are other names for the same kind of program: written rules that the platform carries out on its own.
Does a trading robot trade on its own 24 hours a day?
It trades on its own as long as MetaTrader is open and connected. If you close the terminal, it stops opening and following trades. Gold and forex also close on the weekend, and then no robot trades. To stop depending on your computer, use a VPS for MT5.
Does an MT4 EA work on MT5?
No. The .ex4 file from MetaTrader 4 doesn't run on MetaTrader 5, and the .ex5 doesn't run on MT4. The two platforms use different languages, MQL4 and MQL5. A robot from MT4 only reaches MT5 if its author rewrites it and releases a version of its own.
Can I use more than one robot on the same account?
You can. Each robot sits on its own chart and tags its orders with an identification number, the magic number, so it doesn't touch the other's orders. The thing to watch is the lot: split the account between them, so that the sum of the risks fits what you accept on a bad day.
How much does a trading robot cost?
There are free robots, monthly rentals and purchases with a number of activations. Before you pay for anything, the free demo lets you watch the robot run in the Strategy Tester of your MetaTrader. The buying models are in how to buy an EA on the MQL5 Market, with rental and activations.
Can I build my own trading robot?
You can. MT5 comes with MetaEditor, where you write the robot in MQL5 and generate the .ex5. Writing the rule is the quick part. What takes time is testing over several periods, checking the execution and getting the lot and the protection right, until the robot behaves the way you expect.
A trading robot doesn't guess the market: it repeats a rule. Now you know what parts that rule is made of and what to ask about each one. Pick the rule that fits you and check it with the free demo in your MetaTrader: see our gold EAs side by side.


