Select Language

Backtest Expert Advisor (EA)

You can perform backtests on automated trading programs known as Expert Advisor (EA) using MetaTrader5 (MT5)'s Strategy Tester feature. The backtest takes historical data from MT5 and runs the Expert Advisor (EA) program within a given period to simulate its performance. Here we'll take a look at how to perform Expert Advisor (EA) backtests in MT5.

Step 1

Click "View" in the menu and select "Strategy Tester". (Shortcut keys : "Ctrl"+"R")

Select Strategy Tester Select Strategy Tester

Step 2

The "Overview" tab of the Strategy Tester will open. Select "Single", "Visualize", or "Stress & Delays".

Backtest items Backtest items

Number

Item name

Descriptions

1

Single

Backtest the Expert Advisor (EA) with basic settings.

2

Visualize

Use the visual mode to perform backtesting while displaying trades on the chart.

3

Stress & Delays

Perform backtests by delaying execution and generating slippage.

point Settings can be changed midway

Default settings will change based on which icon you select. You can also change these settings individually from the "Settings" tab and recreate settings of other icons as well.

Step 3

Click the "Settings" tab and set the conditions for backtesting.

Backtest settings Backtest settings

Number

Item name

Descriptions

1

Expert

Select the Expert Advisor (EA) to backtest.

2

Symbol

Select the symbol.

3

Timeframe

Select the timeframe.

4

Date

Select the period for backtesting.
Entire history: Backtest for the entire period where historical data exists.
Last month: Backtest from one month before the current date.
Last year: Backtest from one year before the current date.
Custom period: Backtest for the specified period.

5

Delays

Select the time to delay executions.
Zero latency, ideal execution: No delay.
〇 ms (last ping to your server is 〇 ms): Delay for the transmission time with the broker server as measured by your MT5.
1-1000 ms: Delay for a selected amount of seconds among 1, 5, 10, 20, 50, 100, 500, or 1000 milliseconds.
Random delay: Delay for a random amount of seconds.
Custom delay: Delay specified in milliseconds.

6

Modelling

Select the historical data model to be used for backtesting.
Every tick: Use the ticks generated by MT5 based on 1-minute OHLC.
Every tick based on real ticks: Use the broker's real ticks for the logged-in account.
1 minute OHLC: Use the 1-minute Open, High, Low, and Close prices.
Open prices only: Use the open prices of the selected timeframe.
Math calculations: Select this option if you want to use the Strategy Tester for calculations. This is not for backtesting.

7

Deposit

Select the initial account balance and currency.

8

Leverage

Select the leverage.

9

Optimization

Select the optimization method. Leave the default "Disabled" as it is not used for normal backtesting.

10

Visual mode with the display of charts, indicators, and trades

Check this box if you use the visual mode.

point Historical data model affects accuracy and efficiency

If you choose "Every tick" or "Every tick based on real ticks", the accuracy of the backtest will increase because these two contain the most amount of data. If you wish to perform a quick backtest, choose "1 minute OHLC" or "Open prices only" which contain fewer data. If you wish to analyze the Expert Advisor (EA) performance thoroughly, you should use "Every tick" or "Every tick based on real ticks".

Step 4

Click the "Inputs" tab and set the values for the Expert Advisor (EA) parameters.

Expert Advisor (EA) parameters Expert Advisor (EA) parameters
point Customize parameters

By default, the values set in the Expert Advisor (EA) program will be displayed, but you can change these accordingly. Adjustable parameters vary by Expert Advisor (EA), but in most cases, you can change the T/P, S/L, trade time, and other technical indicators used in the Expert Advisor (EA) program.

Step 5

Click "Start" to start backtesting.

Start backtest Start backtest

Step 6

The backtest result will be in the "Backtest" tab. Also, the "Graph" tab shows the change in the account balance and equity, as the blue and green lines respectively.

Backtest result Backtest result

The backtest result can be saved in two formats, "Open XML" and "HTML".

Related article: Save Expert Advisor (EA) testing report


Date

Created

 : 2022.10.28

Update

Last updated

 : 2022.10.28

Writer

Takayoshi Nakamaru

Manual production consultant, MBA

arrow
Takayoshi Nakamaru

Nakamaru is a manual production consultant at FINTECS, a company that specializes in creating manuals for their clients.
With a wide range of experience from fintech to entertainment, he presents what user-friendly manuals should be like.
He works with numerous large corporations as an external manual production project manager.

【Business information】
http://www.fintecs.co.jp/profile/

Supervisor

Akira Takagi

Systems engineer, MetaTrader administrator

arrow
Akira Takagi

After graduating from Computer Science at the Uninove, Brazil, in 2014, he has worked on various systems development projects.
He participated as a developer in the launch of forex services in 2019. Since then, he has also been involved in the development of MetaTrader plugins and APIs. He is certified by MetaQuotes as a MetaTrader5 Administrator and active in consulting and advisory as well.

Was this article helpful?
Thank you for your feedback.
Thank you for your feedback.

Disclaimer:arw

All information and content provided on this website is provided for informational purposes only and is not intended to solicit any investment. Although all efforts are made in order to ensure that the information is correct, no guarantee is provided for the accuracy of any content on this website. Any decision made shall be the responsibility of the investor and Myforex does not take any responsibility whatsoever regarding the use of any information provided herein.

The content provided on this website belongs to Myforex and, where stated, the relevant licensors. All rights are reserved by Myforex and the relevant licensors, and no content of this website, whether in full or in part, shall be copied or displayed elsewhere without the explicit written permission of the relevant copyright holder. If you wish to use any part of the content provided on this website, please ensure that you contact Myforex.

  • Facebook
  • Twitter
  • LINE

Myforex uses cookies to improve the convenience and functionality of this website. This website may include cookies not only by us but also by third parties (advertisers, log analysts, etc.) for the purpose of tracking the activities of users.Cookie policy

I agree
share
Share
Cancel