Services/Products
Support
Trader's Market
Features arrow Promotion arrow Partner arrow
Services/Products
Support
Trader's Market

Support information for customers, including how to open an account, how to use the trading tools, and a collection of QAs from the help desk.

Web Trader Web Trader
Features Features Features
arrow
Promotion Promotion Promotion
arrow
Partner Partner Partner
arrow
Trader's Market Trader's Market Trader's Market
bg

PC Backtest Expert Advisor (EA)

good

This article was : 

published

updated

You can perform backtests on Expert Advisors (EA) using MetaTrader4 (MT4) / MetaTrader5 (MT5)'s Strategy Tester feature. The backtest uses historical data from MT4/MT5 to simulate the EA's performance.

Here we will look at how to perform Expert Advisor (EA) backtests on MT4/MT5.

Switch between MT4/MT5 tabs to check the steps for each.

mt4
mt5

Step 1

Click "View" in the menu and select "Strategy Tester".

Open Strategy Tester Open Strategy Tester

Step 2

The "Settings" tab will open. Set the conditions for backtesting.

Backtest settings Backtest settings

Number

Item name

Descriptions

1

Expert Advisor

Select "Expert Advisor" from the pull-down list on the left and choose an Expert Advisor (EA) to backtest from the list on the right.

2

Symbol

Select the symbol.

3

Period

Select the period (timeframe).

4

Model

Select the historical data model to be used for backtesting.

Every tick: the most precise method, but takes time.

Control points: a very crude method based on the nearest less timeframe.

Open prices only: fastest method, but only for open prices.

5

Spread

Select the spread for backtesting. The spread is in points and can be manually specified as well.

6

Use date

Select the period for backtesting.

7

Visual mode

Check this box to use the visual mode. When it is checked, a chart window will open at the start of the backtest, allowing you to follow the past price movements and watch the Expert Advisor (EA) make trades chronologically.

The playback speed can be adjusted using the bar next to the checkbox. Use the button next to the bar to pause the test.

8

Skip to

Click this under the visual mode to skip to a specified date. A date earlier than the testing period can't be specified.

9

Optimization

Check this box to perform optimization. Leave it unchecked as this mode is usually not used.

Step 3

To set the parameters for deposits and Expert Advisors, click "Expert properties".

Expert properties Expert properties

Step 4

On the "Testing" tab, set the initial deposit and currency to use for backtesting. If you want to use the currency that is not listed in the pull-down menu, type it in the field like "JPY".

Set the initial deposit Set the initial deposit

Step 5

Click the "Inputs" tab and configure the "Value" fields for the Expert Advisor (EA). You don't have to edit the "Start", "Step", and "Stop" fields as they are used for the optimization feature.

Inputs Inputs
point Customizable parameters

The default "Value" in the "Inputs" tab is set by the EA but can be customized to suit your preferences. The adjustable parameters vary depending on the Expert Advisor (EA) but often include settings such as Take Profit (T/P), Stop Loss (S/L), trade timing, and other technical indicators.

Step 6

Click "Start" to start backtesting. Depending on the settings, this may take some time.

Start backtesting Start backtesting

Step 7

The backtest result will be in the "Report" tab. Also, the "Graph" tab shows the change in the account balance and equity.

Backtest graph Backtest graph

The backtest result can be saved in the HTML format by right-clicking on the report and selecting "Save as Result".

Related article: Save Expert Advisor (EA) testing report

Save the backtest result Save the backtest result

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. If you want to use the currency that is not listed in the pull-down menu, type it in the field like "JPY".

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.

When it is checked, a chart window will open at the start of the backtest, allowing you to follow the past price movements and watch the Expert Advisor (EA) make trades chronologically.

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, but it will take longer time. If you wish to perform a quick backtest with reduced accuracy, choose "1 minute OHLC" or "Open prices only" which contain fewer data.If you wish to analyze the Expert Advisor (EA) performance thoroughly, it is recommended to 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 Customizable parameters

The default "Value" in the "Inputs" tab is set by the EA but can be customized to suit your preferences. The adjustable parameters vary depending on the Expert Advisor (EA) but often include settings such as Take Profit (T/P), Stop Loss (S/L), trade timing, and other technical indicators.

Step 5

Click "Start" to start backtesting. Depending on the settings, this may take some time.

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

Was this article helpful?

thumb_down No
thumb_down Yes

0 out of 0 people found this article helpful.

Thank you for your feedback.

Send