Sign Up for My SUCCESSFUL TRADING TRAINING
I Am Committed to help you to become successful trader and prepared to give away all my personal secrets and techniques...

You will receive a tutorial, plus two bonuses:
  • Indicator for Metatrader
  • and profitable Expert Advisor
  • with absolutely no costs involved!!!

    Sign Up To My FREE TRAINING To Help You to Succeed in Your Trading Career...



    P.S... You Will NOT Be Spammed As A Result Of Your Subscription To My Free Successful Trading E-Course. I Hate Spam Just As Much As You Do!
    March 2010
    M T W T F S S
    « Aug    
    1234567
    891011121314
    15161718192021
    22232425262728
    293031  

    How to Backtest a Metatrader EA the Right Way, Part III - Expert Advisor Optimization

    optimizationOnce we learned how to run the backtes of expert advisor and improve the accuracy of a backtest, it’s time to optimize it. Optimization is a process of selecting the EA’s parameters when it gives the best results on the backtest.

    Most experts have external parameters that you can change. By changing the parameters you changing the profitability of the EA and the way it works.

    If you have access to the source code of your EA you can specify the external parameters, for example

    extern int SellStop = 50; extern int TakeProfit = 20;

    After that you can run the tester with different parameters of SellStop and Take profit. After you run the EA with different parameters you will be able to chose the optimal set of parameters.

    Fore tester optimization you need to check “Optimization” option and by pressing the Expert Properties select the parameters you want to optimize. Then chose the Start value of the parameter, Stop value, and the size of the Step in which tester will switch that parameter for different runs. It looks like this:

    optimization-properties

    Once you put the check mark into and hit “Start” then tabs “Optimization Results” and “Optimization Graph” will appear. Click on “Optimization Results” tab and right click on the field of the tab. You will see the following window:

    optimization-parameters

    You can put the check mark next to Skip Useless Results that option will skip the negative runs of the tester. Now the Strategy Tester will run the EA through the history and with different optimization settings you chose in Expert Properties -> Input tab. The number of each run and the total number will be shown at the left bottom corner.

    Sometimes the optimization runs can take quite a long time depending on the number of parameters are being optimized and number of steps for each parameter.

    testers-counter

    After each run the ending balance of that run is reflected in the Optimization Graph as well as in Optimization Results where you can see all the optimization parameters with ending profit and other factors. Here is an example of an optimization graph.

    optimization-graph

    By clicking at point of interest on this graph Strategy Tester will return you to the Optimization Results tab with the optimization parameter at which the tester achieved that ending balance.

    optimization-results

    Double click at the results line and Strategy Tester. You can select whatever parameters you want. You may base your selection on highest profit, or highest profit factor, or the lowest drawdown. Double clicking will set the selected parameters into the Expert properties. Uncheck the Optimization option and run the Strategy Tester with the selected parameters. That will return the results of the Expert Advisor back test - the results it would have on the historical data with the selected parameters.

    backtest-results

    That’s how “Holy Grails” are made in those online Forex Trading Robots sales letters. Now you can honestly make yourself such a “Holy Grail” on backtests :)

    Now if you are satisfied with the particular back-test run, save the settings of this run into *.set file by going Expert Properties -> Inputs -> Save and save it into Experts/presets folder.

    save-settings1

    After that you can apply saved settings to Expert Advisor that attached to your trading chart. To do that right click on your chart with that has an EA attached to it. Select Expert Advisors -> Properties -> Inputs -> Load. Select the saved .set file and hit Open then hit OK that will load your optimized parameters into the EA to do the live trading.

    That’s all you need to run your EA with the optimized parameters on the back-test. Hopefully the live trading results of this EA will be similar to those on the back-test.

    Leave a Reply

     

     

     

    You can use these HTML tags

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>