Learn

What is an Expert Advisor (EA) in MT5? A simple guide

An Expert Advisor (EA) is a program that places trades on MetaTrader by rules you set. How it works, what it needs to run, and how to try one on a demo account.

By Tradevia Desk Reviewed by Alex Nguyen Published 6 min read
Key takeaways
  • An Expert Advisor (EA) is a program that runs inside MetaTrader and trades by rules written in advance. On MT5 it is what people usually mean by a forex bot or trading robot.
  • An EA needs three things: the MT5 desktop terminal kept open (on your computer or a VPS), automated trading switched on, and the EA attached to a chart. The mobile app does not run EAs.
  • Try an EA on a demo account first, with a small lot size and a stop-loss you set yourself. Judge it by a live record and its drawdown, not by a backtest alone.

An Expert Advisor, or EA, is a program that runs inside MetaTrader and places, manages and closes trades by rules written in advance. On MT5 it is what people usually mean by a “forex bot” or trading robot. This guide explains what an Expert Advisor in MT5 is, how it works, what it needs to run, and how to try one on a demo account.

What an Expert Advisor is

MetaTrader’s own help describes Expert Advisors as applications written in MQL5, the platform’s programming language, to automate analysis and trading. It sorts automated trading programs into two kinds: trading robots, which perform trades, and indicators, which analyse prices (MetaTrader 5 help). A third kind, the script, is a program that runs once and stops.

Expert AdvisorIndicatorScript
What it doesTrades by rules: opens, changes and closes ordersAnalyses prices and draws on the chart. It does not tradeDoes one job once, such as closing all orders, then stops
When it runsContinuously, on each new price tick, while attached to a chartContinuously, while on the chartOnce, when you start it
Needs the terminal openYesYesOnly while it runs

How an EA works

An EA waits for events. The main one is a new price tick, which is every change of price your broker sends. On each tick the EA checks its rules and acts: it may open an order with a lot size and a stop-loss, move a stop, close a position, or do nothing. You control it through its inputs, such as lot size, stop-loss and take-profit distances, trading hours and the maximum number of trades.

An EA does the same thing every time it meets the same situation. It does not tire, hesitate or forget a rule, which is why people use them. Benefits of automated trading lists the others. It also knows only its rules, so what it does depends on how well those rules fit the market you give it.

What an EA needs to run

  1. The desktop terminal, open and connected. The EA works only while MT5 is running. Many people run the terminal on a VPS, a remote computer that stays on around the clock. The MT5 mobile apps do not run EAs, so use the phone to watch or manage trades (MQL5 community post on controlling an EA from a phone).
  2. Automated trading switched on. There are two switches. The platform-wide one is the Algo Trading button on the toolbar (older versions call it Auto Trading) and the matching option in Tools, Options, Expert Advisors. If it is off, no EA can trade, even if you allow trading in the EA’s own settings.
  3. The EA attached to a chart. Double-click the EA in the Navigator window or drag it onto a chart, check the settings that open, and click OK. Its name and an icon appear in the upper right corner of the chart. If the icon shows that trading is not allowed, check the two switches above. Only one EA can run on one chart, so to run several you open several charts.
  4. An account that allows EAs. Most MT5 brokers do. A demo account is the place to start.

Try an EA on a demo account in six steps

  1. Open an MT5 demo account with your broker. It uses virtual money on the same platform.
  2. Put the EA file in the terminal. In MT5 choose File, Open Data Folder, then open MQL5 and Experts, and paste the file there. It is an .ex5 file, or an .mq5 source file that you compile in MetaEditor. Then right-click Expert Advisors in the Navigator and choose Refresh.
  3. Open a chart of the symbol you want, in the timeframe the EA was built for.
  4. Drag the EA onto the chart, read its inputs and set a small lot size.
  5. Switch Algo Trading on and check the icon at the upper right of the chart.
  6. Watch it for a few weeks. The Trade and History tabs show what it did, and the Experts and Journal tabs show its messages. Compare the results with what you expected.

Where EAs come from

  • You write your own in MQL5 with MetaEditor, which comes with MetaTrader. An AI assistant can help you draft code to test: how to use ChatGPT or Claude for forex and gold trading has a prompt for it.
  • The MQL5 Market sells ready-made EAs, and some are free. The MQL5 Code Base shares free source code.
  • Developers and providers distribute EAs on their own sites.

Whatever the source, read the inputs, test on a demo account and look for a live record. How to evaluate a gold EA shows the checks.

Good habits when you try an EA

  • Start on a demo account, then a small live account. Keep the lot size small until you trust what you see. For the discipline side, see how to control emotions in trading.
  • Set your own limits. A maximum lot size, a stop-loss on every trade and a maximum loss per day that you accept. Apply them in your platform where you can.
  • Change one thing at a time and write down what you changed and when.
  • Read the messages. The Experts and Journal tabs tell you what the EA is doing and why an order was refused.
  • Judge it by results that can be checked. A live record with drawdown beside return tells you more than a backtest alone. See what is drawdown?

EA, copy trading or an AI agent?

An EA follows rules a person wrote. Copy trading follows the trades of another trader or strategy. An AI agent plans its own steps toward a goal. Many products mix them. Agentic trading vs copy trading vs EAs compares the three, and AI trading agent vs trading bot explains where AI fits. If you would rather follow a strategy than run your own EA, see copy trading on MT5.

Where Tradevia fits

Tradevia describes its AI as agentic AI for market research, analysis, education and decision support. Optional market-data and connected-account tools remain under your control, and the AI’s output is for you to read and judge. It can be wrong and it is not investment advice: read the AI disclaimer and the risk disclosure.

The strategies in the Tradevia marketplace are built and managed by institutional traders, and they use AI: AI and machine-learning models filter market conditions and manage risk, and an AI agent plans its own steps and uses tools. Each is shown with its live record, with drawdown beside return, so you can judge it by the evidence and not by the label. You choose whether to copy any of them. For gold, start with gold copy trading (XAUUSD): risks, sizing and how to choose.

Questions

Is an Expert Advisor the same as a trading bot?

On MetaTrader, yes. Expert Advisor is the platform's own term for an automated trading program. In everyday talk the same thing is called a bot or a trading robot.

Can an EA run on my phone?

No. The MetaTrader 5 mobile apps do not run Expert Advisors. An EA runs in the desktop terminal, which has to stay open, so people use their own computer or a VPS and use the phone to watch or manage trades.

Do I need to know how to code to use an EA?

No. To use an EA you attach it to a chart and set its inputs, such as lot size and stop-loss. To write one you use MQL5, MetaTrader's language, and an AI assistant can help you draft code that you then test on a demo account.

Can an EA trade gold?

Yes. An EA can trade any symbol your broker offers on MT5, including gold (XAUUSD). Check the contract size, the spread and your lot size for that symbol before you start.

Risk

This is general information, not investment advice. Leveraged products can lose more than you deposit. Read the full risk disclosure

Tradevia Desk
Editorial team