Backtesting and getting it right ! How to correctly backtest an MT4 expert advisor.

During the past few years I have been asked several times to write a tutorial about how to correctly and accurately perform backtesting on metatrader expert advisors. I have to say that I had not done so because there are myriad of other places online in which you can find information on how to backtest expert advisors but then I realized that many of these places are outdated and some others fail to give accurate information about how to really perform the process. So here it is, my very own tutorial on how to accurately backtest expert advisors.

First of all, you need to get some data in order to backtest an EA. Earlier version of metatrader 4 did not have a way to download data directly and this is the reason why many tutorials use the Alpari one minute data to perform the tests. This process is unnecessary and long, other people say that metaquotes data is crap. That is completely wrong as I have several examples of comparison between live and backtesting data with metaquotes data that show that the data received from the metaquotes server is just as good as Alpari’s. However, if you don’t do the process correctly you WILL corrupt your data and render it useless for backtesting. Here are the steps you need to follow in order to perform accurate backtesting :

  • Install a metatrader instance solely for the purpose of backtesting and do NOT open any demo accounts on it (broker DOES matter since some brokers use some non standard nomenclature for the currencies the backtester cannot associate, I recommend you use IBFX’s platform as I know their currency names work ok). The reason not do open any demo accounts is because the updating of data from the brokers server can mismatch with metaquotes data and corrupt it (very important !).
  • Now that you have the new instances of mt4 installed with NO demo or live accounts go to the tools menu, then open up the history center. Now you will see a menu you can open (click on the + sign) on your left with all the currencies which can have data downloaded. Go to whichever currency you want and open it, then double click on the one minute data icon and click the download button on the bottom left side. Say “yes” if it pops up a warning about using metaquotes data (this is normal, it is warning you about there being possible differences between your broker data and metaquotes).
  • Exit the history center by closing it.
  • Restart your metatrader platform.
  • You should now me able to perform 90% quality backtesting from 1999. It is however very important that you do all the above process on a FRESHLY INSTALLED instance of MT4 with NO demo or live accounts added.
After following the above process you will have access to 90% backtesting on several currency pairs which may greatly aid you in the evaluation of newly programmed as well as the optimization of already programmed trading strategies. However, you should be ware that not all backtesting is meaningful and it is only useful up to a point. If you would like to learn what backtesting can be used for, when it says something and when it doesn’t say anything as well as how to know if your strategy can be accurately evaluated with backtesting please consider buying my ebook on automated trading or subscribing to my weekly newsletter to receive updates and check the live and demo accounts I am running with several expert advisors. I hope you enjoyed this article !
Print Friendly, PDF & Email
You can leave a response, or trackback from your own site.

10 Responses to “Backtesting and getting it right ! How to correctly backtest an MT4 expert advisor.”

  1. Scott says:

    Hi Daniel,

    Thanks for posting the back test info. I have followed your instructions and installed ibfx mt4 platform. When I open the platform, a window opens to open an account, I click on cancel so I won't create an account. I now open the history center but I get no currency pairs info to download. What am I doing wrong?

    Thanks,
    Scott

  2. Daniel says:

    Hi Scott,

    You should open the drop down list on the left side menu by double clicking the item you see there (on the history center that is), then it will open and you'll be able to see the currencies. I hopes this helps !

    Best Regards,

    Daniel

  3. Scott says:

    When I open the history center there is only one thing in the left column labeled "symbols"…the words "Interbank FX Trader 4".

    No symbols or anything else, no drop down menu. I suspect it is because I have not set up an account.

  4. Scott says:

    After opening a demo account, I now have a drop down menu with all the currency pair symbols. So I am not sure I can do as you instructed without opening an account. Maybe I am missing a step?

  5. Daniel says:

    Hello Scott,

    Well, if you have now opened an account you need to delete the account and erase all your history data before downloading the metaquotes data, otherwise it will get corrupted by the IBFX data updated from the account,

    Daniel

  6. Scott says:

    Hi Daniel,

    The issue I am having is I cannot download any historical data without first opening an account. Without the account, my platform does not have a drop down menu in the history center. It is only after opening an account that a drop down menu with the currency pairs shows up on the platform.

  7. Pirate says:

    Try Alpari. You will have all pairs in there without opening an account.

  8. Scott says:

    thank you Pirate

  9. nicolas says:

    No you won't. Alpari, and every other broker for that matter, has the same problem.

  10. Archibald112 says:

    Hi,

    Have downloaded IBFX MT4 and installed. Haven’t opened a demo. There are no currency pairs in the History Center. Has anyone experience this before? http://screencast.com/t/5jly6H9mk

    BR,
    Archibald

Leave a Reply

WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.