GoldTriEngine
EA Education

What Is an Expert Advisor (EA) and How Does It Run on MetaTrader 5?

An Expert Advisor (EA) is a program written in MQL5 that runs inside the MetaTrader 5 terminal, reads prices and places, changes and closes trades by rules. It needs the terminal to stay open and connected, follows its rules without emotion, and is only as good as those rules.

YeliasPublished 5 November 20262 min read

The short version

An Expert Advisor, usually called an EA or a trading robot, is a small program that runs inside the MetaTrader terminal. It watches the price on the chart it is attached to, applies a fixed set of rules, and sends orders to your broker: open a trade, move a stop, close a position.

MetaTrader 5 EAs are written in a language called MQL5. The EA does not run on the broker's computer or on a website. It runs on your computer or on a rented server (a VPS) where your terminal is running, which has consequences for uptime that we cover in the VPS lesson.

What an EA actually does

  1. Reads data: the price, indicators and the state of your account.
  2. Checks its rules: for example, 'is there a setup, and is risk within limits?'
  3. Acts: places an order with a size and a stop, or manages an open trade.
  4. Repeats: every tick or every bar, for as long as the terminal is running and automated trading is switched on.
An EA canAn EA cannot
Follow its rules every time, with no fear or greedKnow what it was not programmed to know, such as a surprise announcement
Watch the market around the clock the terminal runsKeep working if your computer goes off, unless you use a server
Manage dozens of calculations at onceGuarantee a profit or avoid every loss
Be tested on past data before you risk moneyProve from a backtest alone that it will work live
Automation removes emotion and adds consistency. It does not add foresight.

Things to check before you run any EA

  • What market and account type is it built for? An EA made for one instrument, time frame or account currency can misbehave on another.
  • How does it limit risk? Look for a stop on every trade and a rule for position size. Be wary of any robot that cannot explain this.
  • Is there a live, verifiable track record? A backtest is a simulation. See backtest versus live results.
  • Test on a demo account first. It costs nothing and finds setup problems before they cost money.

Frequently asked questions

Do I need programming skills to use an EA?

No. You install the file, attach it to a chart and set its inputs. Programming is only needed to write or change one.

Does an EA work when my computer is off?

No. The terminal has to be running and connected. Many people rent a VPS so the terminal runs all the time.

Are EAs allowed?

Most brokers allow them on MetaTrader 5, but check your broker's rules, especially about high-frequency styles.

Sources and method

  • Standard risk-management and statistics formulas. Every example in this lesson uses made-up round numbers to show how the maths works; none of them is a result or a forecast.
Y

Yelias, GoldTriEngine. We trade gold with an automated EA and publish every trade in public. Everything here is built from that live data. See the live account or the EA.

Not financial advice. This is education and research, not a recommendation to buy or sell anything. Trading gold and CFDs carries a high risk of loss, and past results, back-tests and forecasts do not guarantee future results. Read our risk disclaimer. Numbers in this article are computed by our own software from our own price data and trading account; drafting is assisted by AI. Written under the name Yelias.
Contact us