Expert Advisor Tutorial

Figure 2 – Screenshot of trades generated by a simple moving average based Expert Advisor

Expert Advisor(EA) Tutorial

What is an Expert Advisor?

An Expert Advisor is an automated trading mechanism provided by a trading platform to automatically place and manage trades (and orders) based on the trading rules defined by the user. An Expert Advisor is also called by other names like Strategy, Trading System, Trading Algorithm, Trading Robot etc.

An Expert Advisor is programmed in a (programming) language provided by the trading platform based on well-defined entry and exit rules. The Expert Advisor is then deployed in the trader’s trading account, placing orders and trading exactly as per the rules. It should be noted that an Expert Advisor does not have any intelligence of its own – it simply follows the trading rules it is programmed to execute.

For example, consider a simple moving average trading strategy whereby a buy trade is opened when the price crosses above the moving average, and a sell trade is opened when the price crosses below the moving average. This rule can be programmed into an Expert Advisor, thus automating the process of trading. Further rules for risk and money management can be added to the Expert Advisor based on the trader’s requirements.

An Expert Advisor can be developed only if the trading rules are well-defined, clear and precise.

Benefits of Expert Advisor

An Expert Advisor provides back-tested results, which empowers the trader with a clear idea its past performance, its risk profile, risk-reward ratio and various other metrics. The trader can validate his/her trading rules without risking real money and saving valuable time to determine whether the trading strategy is profitable. Expert Advisors also provide advanced features like optimization, which can be used to identify the best set of parameters, instruments and time-frames to trade.

Human emotions can have a negative impact when trading based on strict rules. Most traders are likely to ignore their own trading rules or indulge in overtrading when trading manually. One of the most important advantages of using an Expert Advisor is that it removes human emotions from trading. Since the trading rules are clearly defined, the trader is not required to manual take decisions which can be impacted by emotions, but rather let the Expert Advisor trade without emotions.

Expert Advisors also allow automation of risk and money management, thereby freeing the trader of deciding the trading lot-sizing, the profit and stop-loss targets and other money management rules.

Limitations of Expert Advisor

One of the most important disclaimers of an automated trading system is “Past performance is not and indicator of future outcomes”. Even though the Expert Advisor may have delivered excellent results in back-testing and even in live trading, it can undergo long phases of drawdowns arising from adverse market conditions. The duration of these drawdowns can continue for weeks and even months. The trader may lose confidence and interest in the Expert Advisor when such a situation occurs and may abandon the Expert Advisor or modify the settings resulting in further losses or different results.

If an Expert Advisor is not thoroughly tested it may contain (programming) software bugs and glitches which can cause trading losses and errors. Deploying an Expert Advisor which has not been thoroughly tested is a big risk to the trader’s account.

Finally, Expert Advisors cannot interpret market events like geo-political risks, economic crisis, wars, natural calamities which can adversely affect the performance. In such situations, it is prudent to shepherd the Expert Advisor by reducing the risk exposure or by stopping the Expert Advisor altogether.

Expert Advisors in Practice

MetaTrader and VertexFX are two popular trading platforms for developing and deploying Expert Advisors.

Figure 1 shows screenshot of the input parameters of a basic Moving Average and Price crossover based Expert Advisor on the MetaTrader platform. This Expert Advisor opens a BUY trade when the price closes above the Simple Moving Average, and opens a SELL trade when the price closes below the Simple Moving Average.

Price and Moving Average Crossover Expert Advisor configuration

Figure 1 – Price and Moving Average Crossover Expert Advisor configuration

To use the Expert Advisor for live trading (either in a real or demo account), the trader opens the appropriate instrument chart with the time-frame and attach the Expert Advisor. For example, if the trader wants to trade this Expert Advisor on EURUSD and hourly chart, the trader first opens the EURUSD H1 chart. In the next step the trader attaches the Expert Advisor to the chart by selecting the Expert Advisor from the Experts list in the Navigator window, and dropping it on the opened chart.

In the next step, the trader must configure the input settings of the Expert Advisor. In this example, the trader must configure the Moving Average Method, the Moving Average Period and Moving Average Price Field – since these settings define the entry and exit rules of the Expert Advisor. The trader must also configure the money and risk management settings like Lot Size, Stop Loss, Take Profit, Breakeven and Trailing Stop etc. Expert Advisors use the concept of Magic Number to distinguish trades generated by it from the trades generated by other Expert Advisors, or those opened manually by the user.

Figure 2 shows a screenshot of the EURUSD H1 chart with the Expert Advisor attached to it (as explained in the previous step) with a few trades opened and closed. The accuracy of the Expert Advisor can be easily verified by studying the chart, the trade entries and exits.

Figure 2 – Screenshot of trades generated by a simple moving average based Expert Advisor

Figure 2 – Screenshot of trades generated by a simple moving average based Expert Advisor

To summarize, an Expert Advisor is a powerful tool available to traders to automate their trading and trade methodically. With thorough research, in-depth analysis and testing a trader using an Expert Advisor can be more successful than a manual trader.