Method of Backtesting on MT4 (Windows)
In MT4, you can perform EA backtesting.
Here, we will guide you through the basic method of backtesting.
Backtesting can simply test set parameters, or it can involve optimization testing (determining which parameter values yield the best results), which takes more time.
MT4 Backtesting Setup
Prepare the EA you want to backtest in advance and install it on MT4.
Displaying the Strategy Tester
MT4 backtesting is performed using a tool called the Strategy Tester.
To display the Strategy Tester, select "Strategy Tester" from the "View" menu in MT4.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_68fb253ef5.jpg)
Strategy Tester Settings
In the 'Settings' tab of the Strategy Tester, configure the following items (refer to the image numbers):
①Select the Expert Advisor on the left side, and choose the Expert Advisor to test on the right side
②Select the currency pair to test
③Select the time frame to test
④Choose the model (which price to use for testing)—typically select 'Every Tick'. If you want to save time, other options are available but reduce reliability
⑤If specifying a period, check 'period' and specify it
⑥Set the expected spread
⑦Visual mode (displays the test content on a chart, which extends testing time)
⑧Choose whether to perform an optimization test (checking this will perform optimization based on the settings in the next expert settings)
⑨Set the account, parameters, and content of the optimization to be tested. Clicking the button will display a dialog.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_2_40438f7c21.jpg)
Expert Settings 'Test Settings' Tab
①Set the initial margin at the start of the test. You can input 'JPY' directly next to the amount to test with a yen account.
②Select the position to test: both buy and sell (Long & Short), buy only (Long only), or sell only (Short only).
③Select which item to optimize.
④Checking the genetic algorithm can streamline the calculations during optimization.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_3_cb0dbf05f5.jpg)
Expert Settings 'Input Parameters' Tab
In the 'Input Parameters' tab, set the parameters and the settings for optimization testing.
①Check the items to be optimized.
②For simple testing, set parameters in the value field.
③Specify the minimum value for optimization testing.
④Specify the interval from the start value for optimization testing. ⑤Specify the maximum value for optimization testing.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_5_1c1eeb5b76.jpg)
Expert Settings 'Optimization' Tab
In the 'Optimization' tab, you can set the test to end when specific conditions are met. If not set, it's okay not to check anything.
Once the settings are completed, click OK and close the dialog.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_13_fa0cc878ac.png)
Starting the Test
Once the settings are complete, click Start to begin the test.
Depending on the length of the test period or the number of optimization test combinations, the computation can take several hours to several days. When setting up, try to configure the test period to be as short as possible.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_6_7239728658.jpg)
Checking MT4 Backtest Results
Once the test is completed, depending on the test content, the Strategy Tester displays the following five tabs, allowing you to check the results.
Optimization Results
Results of the optimization testing are listed. You can check the profit and loss and the extent of drawdowns for each parameter.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_11_b8664a450d.jpg)
Optimization Graph
You can check the results of the optimization testing in a graph.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_12_944b4e6432.jpg)
Results
The details of test trades are displayed in a list. You can closely check at which prices the trades were made.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_7_da7a390a02.png)
Graph
You can view the trends of account balance and margin in a graph. The blue line represents the account balance, and the green line represents the margin.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_8_7b2217f6f4.png)
Report
You can review an overview of trades over the period. Quickly check the test quality, profit and loss, profit factor, number of trades, size of drawdowns, consecutive wins, and losses, etc.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_9_c2e6aef9cf.png)
Saving Reports
Right-click within the Report tab, select Save Report, and save it in HTML format viewable in a browser.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_10_68921a200d.png)
Receiving Price Data
In MT4 backtesting, if you have insufficiently received price data, you may not be able to perform the backtest.
There are several methods to add rates, but here we introduce the simplest method of receiving MetaQuotes price data.
Please try this if your backtest is not working properly.
Chart Settings
Select "Options" from the "Tools" menu in MT4, and in the displayed dialog, enter 999999999999 as the maximum value in both "Max bars in history" and "Max bars in chart" tabs, then click OK.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_14_992356ec3a.jpg)
Downloading Price Data
Select "History Center" from the "Tools" menu in MT4.
In the displayed dialog, select the timeframe for the symbol you want to test, and click Download to start receiving price data.
![](https://research-titanfx-cms.s3.ap-southeast-1.amazonaws.com/mt4_backtest_15_6d3fdf2630.jpg)