Learn everything about Expert Advisors (EAs). Discover how to automate your MetaTrader trading strategy with MT5 and MT4 Expert Advisors. Find how Forex Trading Robots can help to start and improve your algorithmic trading.
Table of contents
- 1 What are Expert Advisors, EA Forex, or EA Robot?
- 2 How do I create an Expert Advisor in MT4?
- 2.1 Having knowledge of MQL5 or MQL4 programming
- 2.2 Using an EA builder program
- 2.3 Hiring a professional MT5 or MT4 programmer to develop the Forex Robot
- 2.4 How to install an Expert Advisor (EA) in MetaTrader
- 2.5 How to learn developing an EA from scratch?
- 2.6 Expert Advisor example
- 3 Typical functions of an Expert Advisor (EA)
What are Expert Advisors, EA Forex, or EA Robot?
An Expert Advisor —also known as EA, trading EA, or Forex robot— is a program that performs trading operations automatically. Some of them with a minimum of human intervention. These trading operations are executed by the EA according to conditions previously set in its algorithm. In turn, these conditions are designed and introduced by a specialist called Expert Advisor programmer.
Expert Advisors (EAs) run on the MetaTrader trading platform. Thus, they can be used on both MetaTrader 4 (MT4) and MetaTrader 5 (MT5) terminals. These algorithmic trading programs are capable of multitasking with total autonomy. Some of their most relevant functions are the following:
- Steadily monitor compliance with a series of market conditions.
- Alert and notify about events of interest that occur in the financial market.
- Control risk through pre-settled money management policies.
- Execute a market entry order according to certain conditions established in advance.
- Modify positions currently open on the trading platform.
- Close partially or completely open positions in the terminal.
So basically Expert Advisors use their algorithms automatically to search for price patterns as well as to monitor financial market conditions. As Forex robots they can also execute operations when trading trends are favorable. They also calculate and adjust the size of the positions with total autonomy to maintain strict control of the risk. Likewise, EAs can add and modify key parameters of a market order as StopLoss levels, TakeProfit limits, and Trailing Stop features.
In MetaTrader platform, depending on the broker options, Expert Advisors can be used for trading any of the following financial assets:
- Forex currency pairs (e.g.: EURUSD, GBPUSD, USDJPY).
- Cryptocurrencies (e.g.: Bitcoin, Ripple, Ethereum).
- Commodities (e.g.: Gold, Corn, Wheat).
How do I create an Expert Advisor in MT4?
You can create an Expert Advisor (EA) or Forex robot using one of the following options:
- Having knowledge of MQL5 or MQL4 programming.
- Using an EA builder program.
- Hiring a professional MT5 or MT4 programmer to develop the Forex Robot.
Having knowledge of MQL5 or MQL4 programming
A MetaTrader Expert Advisor for MT4 or MT5 can be built using MQL programming language. If you do not have programming knowledge, chances are that learning to program MetaQuotes language will be difficult for you. In addition, this will take significant time for you. A time that, of course, you will not be able to devote to trading.
There is also the option of using tools that are integrated into the MetaTrader trading platform itself, such as MQL4/MQL5 Wizard. This tool guides the trader step by step in the development of EAs. This is most useful in the construction of forex robots for simple trading strategies.
MQL4/MQL5 Wizard can also help to develop EAs that use MetaTrader built-in financial indicators such as the moving average. However, it will not help in those trading strategies with a certain degree of complexity.
Another widely used option among traders with no programming skills is to use an MT4 robot builder.
Using an EA builder program
For those forex traders without MQL programming knowledge, there are so-called MT5 and MT4 EA builders. They can be also useful for beginner MQL programmers. These are programs that, as the name implies, allow you to build MetaTrader robots in a simple way. These Expert Advisors can be developed from simple strategies and some of medium complexity.
Most of these algorithmic trading builders are paid. Some are desktop applications that can be downloaded and used upon payment of a license. Others are used online and are paid via monthly subscriptions or for each robot created.
Finding the best MT4 EA builder
How to decide among multiple expert advisor builders? Several characteristics must be compared when choosing the program that best meets our needs. The most important would be these:
- Cost of the tool.
- Built-in financial indicators that can be used in the EA.
- Features that can be included (e.g.: TakeProfit, StopLoss, TrailingStop).
- Interface and ease of use.
Soon we will add a detailed comparison of the different robot builders available out there.
Hiring a professional MT5 or MT4 programmer to develop the Forex Robot
We start from the fact that you have an amazing Forex trading strategy that you want to partially or completely automate. Most of these systems use indicators to generate buy and sell signals. It is also usual for trading systems to be based simply on the movement of prices or candlestick. Unlike many people think, trading systems that only use price movements can become more difficult to program than those based on indicator signals.
How to install an Expert Advisor (EA) in MetaTrader
How to learn developing an EA from scratch?
We have found a useful MQL4 Expert Advisor tutorial. It will show you the development process of a basic Forex robot for the financial market. You can also take it as a first step to learn MQL4 language.
Notice that learning to code an Expert Advisor is not just about programming. At least you must also understand the following concepts:
- What is a currency pair?
- How to calculate the lot size of a trading position?
- How important is it to set your money management for risk control?
- What are the optimal points to open orders (buy order and sell order)?
- When is the proper moment to close the open trades?
- Where to place the TakeProfit point and the StopLoss point?
Expert Advisor example
Here you can download the EA ‘Forex Growth Bot mq4‘ that will serve as an example to explore the code of an Expert Advisor. Notice that its source code can be found on the web. We are not violating any copyright law by posting it.
Typical functions of an Expert Advisor (EA)
Here it is a list of the standard features that can be found in most of the Expert Advisors (EAs). Also, ready-made optional features that can be easily added to any trading system.
This is by no means a comprehensive list. When ordering an EA you can add almost any feature that you want to your Expert Advisor. Just request it using this free form.
Standard Features of a Forex Robot
These standard features should be part of every Expert Advisor:
- Run Once per Bar: option to run on every tick or only at the open of each bar.
- Separate Instances: option to run on multiple charts at the same time even on the same currency pair. It must also run alongside other EAs as well as allowing manual trades.
- Retry on Error: in the event of a server error —such as a requote or a timeout—, the EA must retry the last action for several attempts.
- Automatic Stop Adjustment: avoid “invalid stop” errors. If stop loss, take profit or pending order price trigger an error, the EA must adjust the price to the closest valid price.
Optional Features of a Forex Robot
These optional features can be easily added to your EA upon request. Should you explicitly specify which optional features you would like to add to your Expert Advisor:
- Money Management – Adjusts your lot size. Set your maximum loss per trade according to a preset percentage of equity or account balance. This method requires a stop loss to be placed on all orders.
- Martingale Lot Sizing – Increases the lot size for each consecutive win or loss order. An adjustable multiplier allows you to control the lot size increase. Thus, you can limit the maximum lot size to control your risk. There are several variants of this function, so you can feel free to choose any of them.
- Trailing Stops – Allows you to specify the minimum order profit before the trailing stop is activated. You can also “step” the trailing stop to move every x number of pips.
- Break-Even Stop – Set your stop loss to break even after a specified level of profit. You can even “lock-in” a certain number of pips in profit.
- Timer – Two types of timers are available. You have the option of using server time or local time. You can also close all orders when the timer stops.
- Daily Timer – Specify the hour and minute to begin and end trading each day. Great for those who trade the same market hours every day.
- Block Timer – Allows you to customize start and end times. Multiple timers allow you to schedule trading around volatile news events.
- Spread Protection – Avoid those large dynamic spreads. Trading will automatically be suspended if the current spread exceeds the maximum spread setting.
- Margin Check – Your EA will automatically suspend new orders if your used margin exceeds the specified percentage. This way you can avoid unexpected margin calls.