zh-hansvitrruropt-brplnlnbmskojaitidhufrfieseneldedacsbgar

How to Set Up an Expert Advisor

Have your ever wondered why forex markets sometimes move so aggressively, literally in the blink of an eye when an economic news item is released? How is this possible? The answer is trading robots that are instructed to buy or sell based on the interpretation of a piece of economic information. These trading algorithms are basically computers programmed to buy or sell, and there is a whole industry that deals with programming and managing these computers. While these moves are mostly attributed to big players in the industry, like High-Frequency Trading (HFT) algorithms, the retail trader has the opportunity to build a robot as well and to apply it to a trading account. Before going into more detail, here I will use  the MetaTrader 4 trading platform to explain how to set up such a robot; but it is worth mentioning that a trading robot can be programmed to buy or sell on other trading platforms as well. As a matter of fact, if you trade with a trading platform that does not offer the possibility of attaching a robot to a chart, that trading platform is incomplete.

Broker Min Deposit Regulation Bonus Read More Visit Site
XM $5 CySec $30 Free Read Review Visit Broker
AvaTrade $100 MiFID 40% Read Review Visit Broker
HotForex $50 CySEC 100%* Read Review Visit Broker
HYCM $100 FCA UP TO $5000 Read Review Visit Broker
FBS $1 IFSC $123 Free Read Review Visit Broker
FIBO Group $300 CySec N/A Read Review Visit Broker
Instaforex $1 FFMS 250% Read Review Visit Broker
easyMarkets $200 CySEC 50% Read Review Visit Broker
XTB.com $250 FCA Up to 30% Rebate Read Review Visit Broker
UFX $50 CySEC, MiFID $50 Free Read Review Visit Broker
eToro $50 CySEC, FCA Up to $1000 Read Review Visit Broker
itrader $250 CySEC UP TO $30,000 per T&C Read Review Visit Broker
Plus500 $100 CySEC N/A Read Review Visit Broker
CM Trading $250 FSP Up to $3,000 Read Review Visit Broker
Trade.com $250 CySEC $25 No Deposit Read Review Visit Broker
* Not valid for EU traders, T&C apply
Broker Min Deposit Regulation Bonus Read More Visit Site
XM $5 CySec $30 Free Read Review Visit Broker
AvaTrade $100 MiFID 40% Read Review Visit Broker
24option $250 CySEC N/A Read Review Visit Broker
HotForex $50 CySEC 100%* Read Review Visit Broker
HYCM $100 FCA UP TO $5000 Read Review Visit Broker
FBS $1 IFSC $123 Free Read Review Visit Broker
FIBO Group $300 CySec N/A Read Review Visit Broker
Instaforex $1 FFMS 250% Read Review Visit Broker
easyMarkets $200 CySEC 50% Read Review Visit Broker
XTB.com $250 FCA Up to 30% Rebate Read Review Visit Broker
UFX $50 CySEC, MiFID $50 Free Read Review Visit Broker
eToro $50 CySEC, FCA Up to $1000 Read Review Visit Broker
itrader $250 CySEC UP TO $30,000 per T&C Read Review Visit Broker
Plus500 $100 CySEC N/A Read Review Visit Broker
CM Trading $250 FSP Up to $3,000 Read Review Visit Broker
Trade.com $250 CySEC $25 No Deposit Read Review Visit Broker
* Not valid for EU traders, T&C apply

What is an Expert Advisor, and How do You Build It?

An Expert Advisor (EA) is a trading robot that can be built using the MetaTrader trading platform and attached to a currency pair to trade it. Such robots are instructed to buy or sell when specific market conditions are met, such as some moving averages crossing, or an oscillator being overbought or oversold, etc.

If you know how to program such a robot – i.e., if you’re familiar with the MetaEditor (people with IT programming experience usually find programming in MetaEditor quite an easy task) – then the first thing to do is to open the MetaTrader platform and on the menu above just click on Tools, then choose the MetaQuotes Language Editor, and a new program will open in a separate window.
11
This is the MetaEditor, and by opening a New Document from the top left, the following pop-up window appears:
12
If you choose the Expert Advisor option, the next step is to give a name to it, and off you go – you can start programming your trading robot. However, if you have no idea about how to program it, simply commission someone else to do that. Assuming an Expert Advisor already exists, what is the next step to follow?

Importing an EA to the MetaTrader 4

After the EA has been built in error-free mode, the next logical step is to import it to the trading platform, the MetaTrader. To do that, the trading platform needs to be opened, and from the File tab on the top left of the screen the Open Data Folder needs to be selected. That is the location where the MetaTrader is installed on the computer, and next thing is to choose the MQL4, then Experts, and simply paste the Expert Advisor file there. The expert advisor should have the .mql or .exe extension.
13
Closing the MetaTrader platform at this point is mandatory, otherwise the newly created EA will simply not be found. Therefore, after closing and restarting the platform, simply click on the Navigator tab, then in the newly opened window just select the Expert Advisor tab.
14
Your EA should be there, and this is how it is imported onto the MetaTrader 4 trading platform.

Historical Testing

At this  moment in time, all you know is that you have put a trading idea/set-up into a trading algorithm and are expecting it to function correctly. This may be alright, but how about seeing how it would have performed in the past in order to get an idea of its profitability?

This can be easily done using the MetaTrader 4 trading platform as well. Just choose the Strategy Tester tab, and a new window will appear at the bottom of the screen. This new window allows historical testing, and for this one can select the EA, the currency pair, the timeframe, and the period back in time to be tested.
15
By clicking the Start button and waiting for the data to be processed, you will get a detailed report compiled by MetaTrader 4 with all the trades taken, date and time of the entry, the outcome, etc. – basically all you need to know regarding how the Expert Advisor has performed.
16
If the EA turns out to be profitable, then it is time to put it to work!

Attaching the EA to a Chart and Running It

This is a fairly easy task, as all you have to do is to select the Expert Advisor from the Navigator tab as explained earlier, and just click and drag it to the desired chart. The next thing you’ll see on the top right of the chart is an emoticon that shows a face that is upset, as in the image below. This is because the AutoTrading tab is not enabled, and by doing that the emoticon will turn into a smiling face.
17
If you have a smiling face on your chart, the EA is running and the algorithm will open and close new positions as per the instructions it has been given. There’s one more little thing to consider before deciding whether this is the best and easiest way for you to trade forex markets: If you close the trading platform, the EA will stop working and any open positions will not be closed automatically, nor will new trades be opened automatically. To overcome this problem, there are Virtual Private Servers (VPS) that can be rented from various providers. Some brokers offer free VPS hosting based on the type of trading account one has. The VPS will keep the trading platform open 24/7, and hence the Expert Advisor will trade on a constant basis. There are traders who use multiple Expert Advisors on the same account, the idea being that one EA trades in one direction and another one in a different direction, and so overall the exposure is hedged. This is just another way to use EAs, but normally, if an EA is profitable, then it should be profitable over the long run. Such a thing, unfortunately, is not that easy to accomplish.

Was the information useful?
Expert Advisor Explained
3 (60%) 2 votes