Free Forex Indicators
and Expert Advisors

RichPips.com

Home Free Signals Forex Indicators Expert Advisors Forex E-Books Forex Scripts Forex News

 

How do I backtest an Expert Advisor ?

Written by Darren Hunt:


Ok now to the nitty gritty of what we all want to know. Just how do we get a great backtest on an Expert Advisor.

The most important thing is the tick data and its quality. I use ForexTester.com where you will find data for all of the more common trading pairs that are always up dated and go back as far as the beginning of 2001. Just click on the trading pair you would like to back test on and save it to your PC.

The file will be in a .zip format so you will need to unzip it. This can be unzipped in the same location as you saved the original zip file.

Now we want a fresh install of Meta Trader 4. We want to have this install set aside just for back testing EA's so there is no interferance of our tick data later on. If you haven't already got a broker, check out the brokers HERE where you can sign up for free at any of the brokers and download their Meta Trader 4 platform from them.

Once downloaded, install the Meta Trader 4 platform in your root directory (Usually directly into your C: drive and not into the Programs folder) this way we don't get it mixed up with our real trading account and we also get full access to the folder as Windows 7 can limit your use in the programs folder. Also do not Launch Meta Trader just yet as we still need to do some things before we do.

Once installed goto the folder in which you installed and then to the "History" folder. In this instance we chose a broker called "Go Markets" but it really doesn't matter who you choose as we are only after the Meta Trader software.

convert change

Delete all files with the .hst extension that you see here as we only want our high quality tick data to play the game.

Now go back and start up your brokers Meta Trader software. This is what you should see first up;

convert change

DON'T fill anything out. Just click on 'Cancel' as we don't want the broker to start downloading any history.

The next Login window that pops up just hit cancel again.

Goto Tools > Options, then click on the 'Charts' tab where you will see this window;

convert change

and change 'Max Bars in History' and 'Max Bars in Chart' to 99999999999 and click OK. This way we get the max data in that we can.

Goto Tools > History Center, choose 'Forex' and then find the currency pair that you downloaded for. In this case we downloaded the EUR/USD tick data so once we found the EURUSD in the list we double click it then choose 'M1' for the 1 minute data. Choose 'Import'.

convert change

In the browse window, locate where you saved your downloaded data and double click it. Make sure you put a '1' in the skip column and skip row

convert change

You should see alot of tick data in the window. If you do then you have done everything correctly. If not try to change the skip rows/skip column between 0 or 1.

Once imported just close the window. Close all trading windows and just open up a window in the trading pair that you imported the data for. Once open change the timeframe to M1.

Something doesn't look right!!! I hear you say. We still have 1 last task and that is to convert our imported data. In Metatraders Navigator bar you will see a 'Scripts' Option. Choose it to expand the scripts.

convert change

Click on the 'period_converter' script and drag it onto your trading chart. In the popup choose the 'Inputs' and just change the value to 1. This will convert you tick data for the M1 chart.

convert change

Once you hit 'OK' Click on your 'Experts' tab at the very bottom left hand side of the Meta Trader window and you should see something like the image below;

convert change

That means everything went as to plan. Now if you intend to backtest you Expert Advisor on a different timeframe to the M1 then you will need to repeat the period converter for each time frame. Where you change the imput to '1' earlier, you will now need to change it to '5' for M5, '15' for M15, '30' for M30, '60' for H1, '240' for H4, '1440' for D1, '10080' for W1.

An example below of us converting for the H1 where we dragged the period_converter script into our trading window, we get the pop up below as we already have the script attached;

Convert data

We choose 'Yes' then change the input to '60' so we now convert our imported data for H1 timeframe.

convert change


Now all that is left is to shut down Meta Trader and re start it. Everything should now have imported and converted correctly. Remember never create a demo account (Just click cancel) and also cancel on the Login window as this will ruin all our hard work by downloading different data from our broker

Other Topics on Richpips

Free Trading Strategy

What is forex trading?

What is a Forex Demo Account?

How do I load an Indicator?

How do I load an Expert Advisor?

What is the difference between .MQ4 and .EX4 indicator?

How do I convert an .MQ4 to .EX4?

How do I backtest an Expert Advisor ?


 
 
 
 
 
 

HIGH RISK WARNING: Foreign exchange trading, (Forex) carries a high level of risk, that may not be suitable for all investors. Leverage creates additional risk and loss exposure. Before you decide to trade foreign exchange, carefully consider your investment objectives, experience level and risk tolerance. You could lose some or all of your initial investment. Do not invest money that you can not afford to lose. Educate yourself on the risks associated with foreign exchange trading, and seek advice from an independent financial, or tax advisor if you have any questions. Any data and information is provided 'as is' solely for informational purposes and is not intended for trading purposes or advice.

Contact Us | About Us | Privacy Policy