Trader’s Tech – Writing Your Own EA Part 26 – MT4 Strategy Tester

Forex RobotOnce again it’s Monday morning. Hope everyone had a great weekend! Time to dig-in for another week. I know I’m a bit strange but I love Mondays. Maybe that’s because I love my work.

If you’re new to this series and want to check it out from the beginning, you can find that here. And look here for a list of all the programming articles.

In Part 25 we actually got around to compiling our EA. Woohoo!! So, now it’s time to run some preliminary tests. But first, we have to look at MT4’s strategy tester.  I can’t say that MT4’s strat tester is the best in existence, but it works fairly well for testing the functionality of EAs that don’t require direct intervention for their operation.





Trader's Tech - Strat Tester 1You can start the Strategy Tester by clicking the indicated icon on the upper toolbar. The Strategy Tester will open in the lower portion of the MT4 window.





Trader's Tech - Strat Tester 2Notice the tabs at the bottom of the dialog and the buttons on the right. I will be referring to these as we discuss the tester. We are currently looking at the Settings tab. The Settings tab controls the testing environment. You can also see the Journal tab. The Journal tab will show you the tester log entries. Included will be any experts log information that is fed from the EA (using the Print and Alert commands) and information about the trades. Additional tabs will appear when you begin testing which include a listing of the trades taken during the test, a graph of those trades and a detailed statistical report of the test. Your test will only be as accurate as the data you have on pricing. We’ll go into more detail about the data when we start running actual tests on the strategy rather than just tests to prove the EA is working properly.


Trader's Tech - Strat Tester 3

To run the EA Test, set the parameters as you see them in the screen capture. Be sure to set your new EA in the Expert Advisor field. Set the Period to M1 (1 minute) to be sure there are a lot of crosses. Uncheck the Use Date checkbox so the tester will use whatever data you have available. As I said, we’ll worry about good data at a later time.  Check the Visual mode checkbox. This will show you the moving chart as it runs. When you are ready, click the Start button. As chart will appear and will show you the trades as they are taken. You can click the pause button (two vertical lines to the right of the Visual mode checkbox) to pause the execution.



Trader's Tech - Strat Tester 4

At this point you can change the chart parameters and colors if you prefer. I’ve been using white charts lately (I change up periodically just to keep it interesting), so I’ll change to white charts. To change the chart colors, just right-click on the chart, select Properties and click the Colors tab. I usually just select the Black on White color scheme from the drop down list above the chart image. Then click OK. Then you can add the moving averages so you can see them cross. Click the Indicators button in the upper toolbar to add the indicators. You’ll have to add each of them separately. I also prefer candles, so I click on the Candles button on the upper toolbar to switch my chart to candles. You can then save your chart template. If you use the name of the EA when you save the template, that template will be used whenever you run the tester on this EA.


Well, here’s a good stopping point for today. Next time we’ll talk about how to interpret the results of the initial testing. Have a great day and thanks for your attention. Please follow me on Twitter and LinkedIn.




The following two tabs change content below.
Winners Edge Trading was founded in 2009 and is working to create the most current and useful Forex information and training available on the internet.

Winner’s Edge Trading, as seen on:

Winner's Edge Trading in the news