How to Backtest Your Trading Robot

by FX EA Review
How to Backtest Your Trading Robot

Introduction

A trading robot or an expert advisor carries out trades with full automation. It can also act as an indicator (Suggesting executions) or a trade manager (Managing your current positions). The market is filled with robots that claim to make you rich overnight with extremely low drawdowns and high win rates. 

Confirming the credibility of EAs is a significant issue as many of the new traders give in to them. These automated trading systems are not foolproof. Most are developed with poor risk management, i.e., grid or martingale strategies that may give good results in a backtest but fail in real-time. Running these systems through a comprehensive analysis can provide us with a proper insight into their efficiency; however, sufficient knowledge is necessary to read the results as they can be confusing and misleading.

Where can I backtest my trading robot?

Automated trading systems are usually available for testing out on the industry-standard MetaTrader 4 and 5 platforms. The software has its strategy tester in which one can insert their EA with various inputs (time frame, spread, minimum initial deposit, etc.) to analyze their trading robot. To access it, open your MT4/5 software on your PC and head over to the view tab, where you’ll find the tester. Ctrl+R is the shortcut key.

The portion highlighted in red shows the place from where you can access the strategy tester in MT4

Image 1: The portion highlighted in red shows the place from where you can access the strategy tester in MT4.

Benefits of the MT4/5 strategy tester

The strategy or robot tester in the MetaTrader platform will provide you with accurate results over a selected period. It has many different customizations, as mentioned before, which can be elaborated as follows:

  • One of the unique features of MetaTrader is its historical center. From there, one can download tick data dating back up to 1993 for various forex, metals, CFD futures, etc. With such a vast history, you can test your robot’s performance for more than 27 years.
  • The robots that work on MT4 can be tested on nine different time frames (M1, M5, M15, M30, H1, H4, and Daily), while MT5 has 21 (M1, M2, M3, M4, M5, M6, M10, M12, M15, M20, M30, H1, H2, H3, H4, H6, H8, H12, Daily, Weekly, and Monthly).
  • Different models are available that range in the type of tick quality used to check your EA. The modeling quality is available up to 99.9 percent that is enough to mimic real market conditions.
  • The spread can be customized to your liking, with various values to see if your robot will perform better with an ECN broker.
  • Specific dates can be entered, which is extremely beneficial if one wishes to test his automated trading system under various market conditions—for example, analyzing the result of your EA during the global recession period during the years of 2007-2009.
  • A comprehensive breakdown of the final results is available in a graph that displays balance and equity and a downloadable report. It includes statistical data and other information about your automated trading system to predict if it will be profitable in the future.
A nearly ideal report

Image 2: A nearly ideal report

With all the above-mentioned plus points of the MT4 strategy tester, the service may not be enough. Other expertise is equally important to read the outcomes after backtesting your EA.

How can I know if my trading robot will work in the future?

Three skills are necessary to learn if you want to predict your EAs performance in the future:

  • Reading the report
  • Analyzing the graph
  • Reading the results

Reading the report

The report is by far one of the critical determinants of an EAs performance. Essential factors such as drawdown, profit factor, win ratio, gross loss, net profit, number of trades, modeling quality, etc., can be found by taking a peek at it. Let’s dive into the required parameters for our observation when we backtest a trading robot:

  • Modeling quality should be above 90 percent in all cases.
  • No mismatched chart errors are necessary.
  • Gross loss has to be above the gross profit so that your balance is on the positive end at the end of a set trading period.
  • Profit factor and win ratio can give a deep insight into whether your EA is successful or not.
  • Drawdowns are significant. On your report, they are at one’s disposal under three different names, i.e., absolute maximum and relative. We won’t go into the deep meaning; nevertheless, keep in mind increased drawdown means more risk for your account.
  • Average profit and loss trades can give you an overall mean ratio on the win/ratio of the trading robot.

Analyzing the graph

When it comes to backtesting reading the graph is as critical as the results. A robot with top-notch performance will have a slightly upward curve for both the balance and equity. Sharp drops in equity or balance should raise the alarm as it indicates risky strategies, i.e., martingale or gird. The examples below will help you understand these much better, obtained by testing robots through a period of one year:

The graph shows abnormal performance by an expert advisor. The account is sure to be blown up

Image 3: The graph shows abnormal performance by an expert advisor. The account is sure to be blown up.

A much better rising curve; however, don’t ignore the drawdowns near trade 365. Such ups and downs can be confirmed using the results

Image 4: A much better rising curve; however, don’t ignore the drawdowns near trade 365. Such ups and downs can be confirmed using the results.

Most stable testing results. There is no separation among the equity and balance curves

Image 5: Most stable testing results. There is no separation among the equity and balance curves.

Reading the results

Any required clarifications that may be necessary after looking at the report or the graphs can be achieved by looking at the results. Each trade is listed with its entry/exit, stop loss, take profit, profit, number, lot size, and the final balance.

Trading live vs. demo

There can be huge differences between a live and demo, especially if your robot is a scalper. On a real trading account, your EA’s overall working and results may vary slightly or significantly depending on the trading conditions, market liquidity, volatility, etc. Backtesting ignores these parameters, so it’s the first choice to run your automated trading software on a live portfolio with a small deposit for testing purposes.

You may also like

Leave a Comment