Forex Training with Marc Walton

Results 1 to 2 of 2

Thread: How to Back Test a Strategy in Metatrader

  1. #1
    marc walton's Avatar
    marc walton is online now Administrator
    Join Date
    Aug 2009
    Location
    Canary Islands
    Posts
    388

    Thumbs up How to Back Test a Strategy in Metatrader

    How to Back Test a Strategy in Metatrader.The following is Vassilis’ entry for the summer competition. If you are trying to test a strategy & especially an ea or robot, then it is vital that you test it both in current “live” markets & just as important, look and see what happened in the past. I am technically hopeless and usually get people to do this kind of stuff for me, but I just had a play, following Vassilis’s article and IT WORKS!

    Backtesting

    When you are given a new system it is good to be able first to test if the system works and second to learn the system. In order to do this you have to be able to back test the system manually. Of course it cannot replace real life conditions but it is the next best thing to do. With real life conditions maybe you have to wait days before something happens. With back test you can fast forward the candles and when there is a setup stop candle display and analyze the setup. I decided to write a manual instead of creating a video because it is going to be easier to print the manual and follow the instructions instead of viewing a video and try to remember all the steps.

    One easy way to do the back test is set the auto-scroll off and scroll back your charts . Then you can move one candle at a time pressing the F12 key (by the way Shift F12 will hide the current candle). This has a drawback. You can always “cheat” and see the next bar.



    One more thing that I find very useful. There is a small grey triangle at the bottom left side of the screen (shown by the red arrow). Now let’s say you move the grey triangle under a certain bar, it could be the 15min bar at 7 am of July 9th. Now if you change the time frame the chart will ALWAYS be centered at this 15 min bar. If you show the monthly it will the month of July above the gray triangle, if it is the daily it will be the 9th of July if it is a 1 min chart it will be at 7:01 (the 1st bar of this 15 min period). This is a very nice tool but the auto-scroll button must be turned off.

    Now let’s see at a more sophisticated way to back test our system.

    Metatrader has a built in strategy tester that we are going to use.

    I do not think you have to go back 5 years or 10 years to do the back test. Select a period of 2-3 months. Normally back testing is used to prove the profitability of a system and learn the system. In our case since we know that Marc’s system is solid we are going to use back testing to train our minds and skills.

    First it is a good idea to print the calendar of events. To do this you go to forexfactory and select this week instead of Tomorrow or Today. You will find this at the upper right part of the calendar screen, just above the Actual Forecast Previous columns.



    After you select week you will see the calendar of the current week. If you want you can sele ct filter (it is above the Chart column) and set it to the red factory only. That way you will only display the important news.

    Then from the left part of the screen you select the first week of the period you want to check and you print it selecting Print Current View. Then you select the next week and print it etc. You now have a list with all the events for the selected period. You could fold the page and hide the results but anyway we all know by now that news move prices not in the way they should (lol). This printout will help us avoiding enter a trade when important news are due.

    Next we are going to work with the Metatrader. I suppose that you know the basics about adding indicators, using templates etc so it is not going to be a guide for a complete newbie.

    I would suggest that you open a new demo account in case you mess things up. So after opening your platform go to Tools/Options/Charts and change the max bars in history AND max bars in chart. Just keep pressing the 9 till you hear a bell. Then you press OK. If you open the options box again you will notice that MT4 put the maximum number allowed.

    Then you have to download the data for the specific pair. To do this from the main menu you select Tools and History Center.



    You will see something that looks like the above picture. You select the currency pair that you want to use in my case is Aud/Usd and because there is no data for this pair all time frames are gray. Then press Download. You might get a message like the following one.


    Press OK and continue. You will see a green bar that is getting filled as data is downloaded. Since we are not working with a robot that is pip sensitive small differences between brokers are not important.

  2. #2
    marc walton's Avatar
    marc walton is online now Administrator
    Join Date
    Aug 2009
    Location
    Canary Islands
    Posts
    388

    Default How to Back Test in Metatrader PART 2

    PART 2

    You will notice that the 1 min chart is colored and all other time frames are gray. If you double click the remaining timeframes you will see them become colored because all time frames are calculated from the 1m timeframe. After you finish this process your screen should look like this.



    You have to do the same with all currency pairs you want to back test. As Marc suggests it is wise to “learn” one or two currency pairs, so start with a currency pair you are familiar with. Next time you can try with another pair. When finished press the Close button.

    Now create a NEW chart for the currency you downloaded (in this case Aud/Usd). Then select from the menu View and then Strategy Tester. Your screen should now look like this.



    Now you have to do the following settings. As an expert Advisor you select Moving average. Normally you should select an expert advisor that does nothing but none is available from Metatrader. Actually as I mentioned before the Strategy Tester is used to test the efficiency of an Expert Advisor. In our case we are using it to train our minds. Then where it says symbol you select the currency that you want to work with. In this case is Aud/Usd. Then select the model Every tick. Tick the Use date box and select from-to dates for which you have downloaded data. If downloaded data ends in April and you select as a test period May 1st – May 31st obviously it is not going to work and you will hear a tone like a singing bird (this is the best description I found).

    Make sure you ticked the Visual Mode and from the right part of the screen the Time frame (H1 in our case) and UNCHECK the optimization box.

    Press now the start button and you will see how the bars are getting formed. To pause the process you have to press the button with the two vertical bars between Visual mode and Skip to buttons. The gauge to the left can be used to regulate the speed of candle display. It is better to use the right and left arrow of your keyboard instead of the mouse. You have a better speed control.

    Now you need to import the template. You cannot do it before. If you watch the last picture you will notice that there are two tabs for the AUDUSD. The current one says AUDUSD,H1 (visual) and was generated by the Strategy tester. Now you can activate Marc’s template. The procedure to follow now is to stop (or slow down) the candle appearance, analyze the situation, draw your lines etc

    I like to draw 3 horizontal lines that would be my entry, stop loss and exit levels. You could also draw a small arrow on the candle you decide to enter and another one on the exit candle or simply take notes on a piece of paper.

    We do not live in a perfect world. You cannot change the time frame and see what happens on daily or 4H chart. There is a program that is called Forex Tester 2 that can do this, but it will not work with the metatrader indicators. It has moving averages, MACD, RSI, Stochastis but not the goodies we are used to like the Daily range calculator, Breakout Box etc. And of course you will have to learn another program that looks like metatrader and unfortunately it is not free.

    To be successful you must feel confident about your system. The only way to do this is to take many trades using this system. Backtesting is one way to obtain this confidence quicker. It also helps you to master the system. You will not “forget” key points. Repetition is the mother of learning (I think what you have between your ears is the father lol)

    In case you have difficulties replicating my instructions please do not hesitate to contact me through the forum. It is probably something that I forgot to write.

    Happy Back Testing

    Vassilis

Similar Threads

  1. back in the game, AND still learning
    By richard dee in forum Introduce Yourself
    Replies: 2
    Last Post: 11-12-2011, 03:39 AM
  2. Forex Trading Strategy
    By marc walton in forum Trading Systems
    Replies: 0
    Last Post: 25-10-2011, 11:11 AM
  3. Back to the trading world
    By nighto in forum Introduce Yourself
    Replies: 4
    Last Post: 29-11-2010, 05:30 PM
  4. Help! where are live test results?
    By needabreak in forum Forex Robots
    Replies: 3
    Last Post: 15-09-2010, 11:58 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •