1. Hello Guest Click here to check FX Binary Point Financial Directory

The Secret Weapon – Back Testing & Optimization

Discussion in 'Robot Trading' started by Sam, Nov 17, 2015.

  1. Sam

    Sam Forum Member

    Sep 1, 2015
    Likes Received:
    Now come to the most important phase of automated trading which is back-testing and optimization of an EA before using it on real money account. MetaTrader4 has a built-in terminal namely “Strategy Tester” to perform this job; this is perhaps one of the best features you can find in your Mt4 software. You can easily test EA results by simulating trades over a long time period in a few minutes and make changes in EA settings for optimized results, for this purpose follow the given below steps;

    Step # 1
    To open the strategy tester window in MT4:

    · Go into the Main Menu >>> View >>> Strategy Tester; or

    · Press CTRL + R on the computer keyboard.

    Now you should be able to see tester window at the bottom of the MT4 screen, as shown below

    Step # 2
    For back-testing, follow the given instructions;

    · From the "Expert Advisor" drop-down list, select your EA (In this example we intend to back-test and modify settings of Moving_Average_Мodify).

    · From the "Symbol" list select the currency pair for tests, e.g. EURUSD.

    · From the "Period" list select the timeframe, e.g. H1, H4, D etc.

    · Check "Use date" and set the time interval to be used in testing and optimization, e.g. from August 1, 2012 to May 1, 2013.

    · From the "Model" list select the "Open prices only" mode. (explanation about each mode of modeling can be read on mql4 website, the company which developed mt4 software)

    Step # 3
    Click "Start" in the lower right corner of the Strategy Tester and prepare to view the test results once the progress bar reaches the end. To view the results, open the "Report" tab of the Strategy Tester.

    Unfortunately, the results are very poor. Our initial deposit is steadily tending to zero. It means our Expert Advisor cannot make profit with the parameters set in the EA settings by default. We have to find such parameter values that will allow the EA to be profitable!

    Step # 4
    In the optimization mode, the Expert Advisor is repeatedly run with different external variables. The MetaTrader 4 Strategy Tester allows you to optimize multiple parameters simultaneously. Now, we need to set the optimization parameters. To do this, click on the "Expert properties" button and open the "Inputs" tab as shown below:


    On the left, select the parameters boxes that you intend to optimize and set their range in "Start", "Stop" and "Step" columns. The Start column represents the minimum value for a given setting, whereas the Stop column is the maximum value. The Step column is the amount that the optimizer will "step through" from the Start to the Stop setting. The above screenshot shows the parameters that we are going to optimize:

    The start and stop values for optimization are set based on common sense. For EURUSD Н1, it appears to be quite reasonable to set the values as shown in the screenshot above. Please keep in mind that in this case we have five-digit quotes in MetaTrader 4.

    Step # 5
    Click “OK” to close the "Expert properties" window and in the Tester terminal check the "Optimization" box on the right. Then click "Start" in the lower right corner of the Strategy Tester. The optimization is now in progress.

    Upon completion, open the Strategy Tester's tab "Optimization results", a window like shown below will appear:


    This time around results are pretty encouraging as you can see in the above screenshot that some combinations of EA parameters result in the maximum profit of $4,658. This is how you can optimize any EA by using different combinations of parameters.

Share This Page