The secret behind writing logic for EAs and performing back-testing to evaluate consistency and reliability

The secret behind writing logic for EAs and performing back-testing to evaluate consistency and reliability

24 November 2014, 08:07
ForexTime
0
876

Forex Expert Advisors for MetaTrader4 are sophisticated algorithms written in the MQL programming language and commonly referred to as trading robots.

Expert advisors are the progeny of years of experience and successful market speculation. Their unemotional approach to trading can help to avoid the detrimental effects of trading anxiety and panic, related to the volatile nature of the currency markets.

Moreover, they are not bound by the limits of human capacity nor do they need rest or the jump-start of a coffee break. EAs can trade the market round the clock and execute multiple trading strategies across securities with speed and precision impossible for a human trader.

Nevertheless, to devise a successful and consistently profitable expert advisor, a certain financial aptitude is required along with honed programming skills in MQL5. Of course the software must be evaluated through rigorous assessment with historical data, called back-testing, to test its reliability and improve its trading acumen.

As a first step, you will need to develop the logic behind the strategy for the EA and the indicators that it will use. A variety of indicators can be combined in an EA as well as different volumes, timeframes and even custom indicators of your own invention.

An accomplished MQL programmer is an obvious requirement for this task and fortunately there are several excellent programmers available and eager to provide their services across the various forex sites and forums. To get started you can head over to the official MQL website’s freelance section https://www.mql5.com/en/job to post your logic for an EA and find a programmer to bring it to life, albeit virtually. 


 

Regarding the logic of the EA, it’s wise to plan for customizable input parameters and a good example is the ability to set a custom volume as a means of controlling your positions’ size which consequently allows for better risk management.


 

The EA interface allows for multiple settings to manage risk, different indicators to test with your strategy and even more options to give you better control of the EA.

As far as back-testing is concerned, a long chart history is necessary in order to evaluate the EA with accurate results. If you don’t have your own chart you can always find one online.

 

A strategy cannot be profitable at all times but on the long run, a solid trading system with proper risk management will probably emerge successful. It’s further advised that you test your EA with multiple pairs and across various timeframes and pay attention to the results. Important values to keep note of is the “Maximum Drawdown” of your strategy to check if you are properly managing your risks. “Total net profit” is of course a good indication of your strategy’s performance. Other values like “Largest profit trade” and “loss trade” can help you identify the underlying cause behind big losses.



These values will help you make the appropriate changes on the indicator parameters to find what suits your strategy best and improve the EA’s performance.


 

For example, when you employ the use of Moving Averages, you can choose the MA200 or MA50 and compare them or you can take the Exponential Moving Average and compare it with Simple Moving Average. Experiment as much as you possibly can in order to find the best parameters for your strategy.

Following back-testing, it’s time to test our EA in the real markets, but in the beginning it’s best to start with baby steps and therefore a small amount of capital to see how the EA will react to an authentic market environment. If the results reflect your predictions you can gradually increase your investment over time.   

“Expert Advisors are the hallmark of risk management”

Yiannis Georgiou

 Written By Yiannis Georgiou, Head of Reception and Execution Departments, at ForexTime.

 

Disclaimer: The content in this article comprises personal opinions and ideas and should not be construed as containing personal and/or other investment advice and/or an offer of and/or solicitation for any transactions in financial instruments and/or a guarantee and/or prediction of future performance. ForexTime Ltd, its affiliates, agents, directors, officers or employees do not guarantee the accuracy, validity, timeliness or completeness of any information or data made available and assume no liability as to any loss arising from any investment based on the same.

Risk Warning: There is a high level of risk involved with trading leveraged products such as forex and CFDs. You should not risk more than you can afford to lose, it is possible that you may lose more than your initial investment. You should not trade unless you fully understand the true extent of your exposure to the risk of loss. When trading, you must always take into consideration your level of experience. If the risks involved seem unclear to you, please seek independent financial advice

NOTES TO EDITORS

The FXTM brand name was founded by Andrey Dashin in December 2012. FXTM provides access to the global currency market and offers trading in forex, precious metals, Share CFDs, ETF CFDs and CFDs on Commodity Futures. Trading is available via MT4 and MT5 platforms with spreads starting from just 0.5 on the Standard MT4 trading platform and from 0.1 on the ECN.MT4 and ECN.MT5 trading platforms. Bespoke trading support and services are provided based on each client’s needs and ambitions – from novices, to experienced traders and institutional investors. The brand name is registered under various jurisdictions, one of which is regulated by the Cyprus Securities and Exchange Commission (CySEC), whereby FXTM is registered under license number 185/12.

 

Share it with friends: