EA-ProgrammierungNordZentrum GmbH & Co. KG DERequest a quote

Basics · automated trading

What is an Expert Advisor?

An Expert Advisor is a program that places, modifies and closes trading orders on its own in MetaTrader according to fixed rules. This page explains what it does technically, how it differs from an indicator and a script — and what it explicitly cannot do.

Freely available, even without an order. Applies to MetaTrader 5 and 4, cTrader, TradingView and TradeStation.

01

What is an Expert Advisor?

An Expert Advisor is a program that places, modifies and closes trading orders on its own in MetaTrader according to fixed rules. It runs inside the terminal, is attached to a chart and reacts to every incoming price. The rules come from the user or the developer — the Expert Advisor makes no decisions of its own; it executes what it has been given.

The abbreviation is EA. It is developed in MQL4 for MetaTrader 4 and in MQL5 for MetaTrader 5. Both languages resemble C++ and are provided by MetaQuotes, the maker of the platform.

The purpose is not to beat the market but to implement a set of rules without deviation. A human skips a signal because the day went badly, or lets a loss run because the position is “about to turn”. An Expert Advisor doesn't — neither for better nor for worse.

02

Expert Advisor, indicator or script: what is the difference?

All three are written in the same language and live in the same data folder. They differ in how long they live and what they are allowed to do.

TypeLifetimeMay tradeTypical purpose
Expert Advisor perma­nently, as long as the terminal is runningyes imple­ment­ing rules autonom­ously
Indicator perma­nently, bound to a chartno calculate, draw, trigger alerts
Script once, then endsyes one-off task, such as closing everything

A common misunderstanding: an indicator that draws arrows in the chart does not trade. If an indicator is to become a trading system, you also need an Expert Advisor that reads its values and derives orders from them. This connection is a development task in its own right, see custom indicator development.

03

Expert Advisor, cBot, trading robot: the same thing, a different platform

PlatformNameLanguageTrades autonom­ously
MetaTrader 5Expert AdvisorMQL5yes
MetaTrader 4Expert AdvisorMQL4yes
cTradercBotC# via cTrader Algoyes
TradingViewStrategyPine Scriptonly via broker con­nec­tion
TradeStationStrategyEasyLanguageyes

“Trading robot”, “trading bot” and “forex robot” are not separate techniques but colloquial umbrella terms. Anyone looking for a “trading bot for MetaTrader” means an Expert Advisor.

TradingView is a special case: Pine Script generates signals and can display or send them, but does not execute orders on its own. If you want a TradingView strategy to actually trade automatically, you need either a broker connection or a port to MQL5 — Pine Script to MQL5.

04

What an Expert Advisor does technically

Useful to know before you describe a strategy — most misunderstandings arise at exactly these points.

01

It is called on every price

The terminal calls the Expert Advisor on every price change — several times per second for liquid instruments. So it doesn't run continuously but is triggered again and again, and each time it has to determine which state it is in.

Consequence: the state must be saved, not kept in memory
02

It distinguishes between candle close and the running candle

Most strategies should only trigger after a candle has closed. If this isn't explicitly specified, the Expert Advisor checks in the middle of the running candle — and the backtest result then differs considerably from live trading.

Belongs in every specification: on which timeframe, at what moment
03

It places orders that can be rejected

An order is not a fill. The broker can reject it — because of insufficient margin, a stop that is too tight, a minimum distance rule or because the market is closed. A usable Expert Advisor evaluates every response and logs it.

Without error handling, the system appears to trade but actually doesn't
04

It has to survive a restart

Terminal closed, computer restarted, connection lost: afterwards the Expert Advisor starts from scratch. It only recognises positions it opened itself if it can assign them via the magic number or a comment.

See Practice: 16 common pitfalls, points 10 and 11
05

Stop-loss, take-profit, trailing stop: the most important terms

These terms appear in almost every strategy description. If you distinguish them clearly, you write an unambiguous specification — and see where your own description still leaves questions open.

01

What is a stop-loss?

A stop-loss is an order that closes an open position at a specified price to limit the loss. In MetaTrader it is held at the broker and takes effect even when the terminal is closed. An Expert Advisor sets it when opening the position and can move it later.

In a price gap, the position is closed at the next available price — the loss can then be larger than planned
02

What is a take-profit?

A take-profit is an order that closes a position as soon as a specified profit target is reached. Like the stop-loss, it is held at the broker. Many strategies do without a fixed target and exit via a trailing stop or an exit signal instead.

A fixed profit target and a trailing stop are not mutually exclusive — the specification determines which takes effect first
03

What is a trailing stop?

A trailing stop is a stop-loss that follows the price in the profitable direction but stays put in the losing direction. This way it locks in profits without closing the position prematurely.

MetaTrader's built-in trailing stop works in the terminal: if the terminal is closed, the stop is not trailed. An Expert Advisor handles this according to its own rules
04

What does break-even mean?

Break-even means moving the stop-loss to the entry price once the position has reached a certain profit. From then on it normally no longer ends in a loss. A small buffer above the entry price that covers spread and commission makes sense.

Set too early, normal price noise closes the position before it can develop
05

What is an ATR stop?

An ATR stop is a stop-loss whose distance depends on the market's average range — the average true range — instead of a fixed number of points. In quiet phases it is tighter, in volatile ones wider.

To be defined in the specification: timeframe, ATR period and multiple
06

What is a magic number?

A magic number is an identifier that an Expert Advisor attaches to each of its own orders. It uses it to recognise its positions — after a restart as well as on an account where other systems or manual trades are running.

06

What you need to use one

Required

  • A trading account with a broker that offers the platform
  • The platform itself: MetaTrader 5, MetaTrader 4 or cTrader
  • Permission for automated trading in the terminal and in the account agreement
  • A computer or server that runs throughout trading hours
  • A stable internet connection

Often underestimated

  • The MetaTrader app on your phone and the web terminal in the browser do not run Expert Advisors — only the desktop terminal does
  • Your working computer is unsuitable: sleep mode and restarts interrupt trading
  • Not every broker allows every trading style — check the rules beforehand
  • Demo and live accounts behave differently
  • An Expert Advisor doesn't replace monitoring, it needs it

The set-up itself takes a few minutes. How it works in detail is described under Installing an Expert Advisor.

07

What an Expert Advisor does not do

Automation removes human weakness in execution. It does not remove the weakness of a strategy.

An Expert Advisor does not predict prices. It doesn't recognise that a market phase is unusual unless this has been programmed. It doesn't compensate for an unsuitable position size — on the contrary, it trades it faster and more often. And it doesn't get better over time unless someone changes the rules.

Anyone selling you an Expert Advisor with promises of returns is selling you something other than software. We do not develop or assess trading strategies. The strategy comes from you and remains your property.

08

FAQ

What is an Expert Advisor?

An Expert Advisor is a program that places, modifies and closes trading orders on its own in MetaTrader according to fixed rules. It runs inside the terminal, is attached to a chart and reacts to every incoming price. The rules come from the user or the developer — the Expert Advisor itself makes no decisions of its own; it executes what it has been given.

What is the difference between an Expert Advisor, an indicator and a script?

An Expert Advisor trades on its own and runs continuously. An indicator only calculates and draws; it places no orders — it provides the basis on which a human or an Expert Advisor decides. A script runs exactly once and then ends; typical for one-off tasks such as closing all positions. All three are written in the same language but differ in their life cycle.

Does Expert Advisor mean the same as trading bot or trading robot?

In substance, yes. “Expert Advisor” is MetaQuotes' term for MetaTrader, “cBot” is Spotware's term for cTrader. “Trading robot”, “trading bot” and “forex robot” are colloquial umbrella terms for the same thing. Technically, in all cases it is a program that implements a set of rules without emotion and without exception.

What can't an Expert Advisor do?

It cannot predict market developments. It implements rules — if the rules are unsuitable in a particular market phase, it still trades them consistently. It also cannot judge whether a news situation is exceptional unless this has been explicitly programmed. And it does not replace risk management: a wrongly set position size leads to losses faster, not more slowly.

Do I need programming skills to use an Expert Advisor?

No. To use one, it is enough to place the file in the right folder, restart the terminal and drag the Expert Advisor onto a chart. All sensibly adjustable values are set up as input parameters and can be changed in the settings window. You only need programming skills if you want to change the logic yourself.

Which platforms do Expert Advisors run on?

In MetaTrader 5 and MetaTrader 4, written in MQL5 and MQL4 respectively. In cTrader the counterpart is called a cBot and is written in C#. TradingView uses Pine Script but does not execute real orders by default — there, the script is used for analysis and signals. TradeStation uses EasyLanguage.

How much does it cost to develop an Expert Advisor?

A trading system in the basic scope with standard indicators, entry and exit rules plus stop-loss and take-profit costs a flat €245 net. Extended systems with money management, trailing stop and filters start at €495 net, custom indicators at €125 net. The binding price is stated in the quote based on the agreed specification.

How can I spot a dubious offer?

By the promise of returns. Anyone who guarantees that a system will make a profit is selling something other than software. Further warning signs: no source code included, no written specification before starting, equity curves as a sales argument, and the same ready-made Expert Advisor for hundreds of buyers at once.

Have a strategy you want implemented?

Keywords are enough to start with. After the initial call you receive a fixed-price quote with a binding delivery date.

EA-Programmierung is a service of NordZentrum GmbH & Co. KG, Germany: Expert Advisors, indicators and trading systems for MetaTrader 5 and 4, cTrader, TradingView and ATAS, developed by André Liebetrau, Dipl.-Inf., a development service provider since 2009. Fixed price based on a written specification, complete source code included.

Request a quote