In Part 35 we discussed adding our two reusable functions PcntTradeSize() and MAXover() to our EA. We’ve briefly touched on using the Strategy Tester to see if your EA is doing what it’s supposed to do. This time we’ll discuss more of the extended functions of the Strategy Tester.
MT4’s Strategy Tester is designed to help you optimize your strategies so as to make them more profitable. You’ll hear traders tell you not to over-optimize your strategy. I know, I scratched my head and said to myself “what does that even mean?” too. Well, what they’re telling you is that tweaking your strategy to conform to a set of historical data (we call that curve fitting), just plain doesn’t work very well. You’ve seen the disclaimers, “prior winning does not guarantee future success”. That’s very true. The market changes in subtle ways every day. You may have a “killer” strategy that makes tons of faux cash in back testing over the last ten years, but continually loses going forward. And tweaking the strategy to get the most profit by changing your TP or SL by two pips or using slightly different moving average values won’t make any difference.
Having said all that, optimization can still benefit you. But you have to look at more than just the profitability of the settings. In the past, I have back tested and optimized EAs for more profit, but discovered that I was only getting one or two additional trades hitting profit and making my results look dramatically different. But statistically, they were only what we call outliers. For those of you unfamiliar with statistics, an outlier is a result that lies outside (hence out-lier) the normal results bell curve and a statistician would reject the result as invalid. Trading robots depend on statistics for their profitability and we can’t use statistically unsound data to predict statistical results. So, while we may look at profitability as one of our test results, we should also look at other statistics, like percentage of winners/losers, average winning/losing amounts, etc. Since I’m not a statistician, most of this is actually outside the scope of our programming discussion, but I wanted to touch on it so you don’t go crazy running tests and thinking you’ve found the holy grail (hint, there is no holy grail. But you’re a trader and you already know that. ;))
We also need to touch briefly on tick data integrity, but I’m going to leave that to a future discussion. That’s a pretty big subject. For this installment, I’m just going to show you how to use the optimization features of the Strategy Tester (ST.)
One of the reasons we use external variables, is so we can allow the ST to plug in the values for those variables when optimizing our EA. To do that, click on the Expert properties button in the upper right corner of the ST.
Notice your whole list of external variables are here. If you want the tester to plug different values into a variable, just check the box to the left of the variable name. Then use the Start, Step and Stop fields to designate what numbers to plug in. It will plug in the numbers starting with the Start field, ending with the Stop field and stepping with the Step field (I know, 10 points for Captain Obvious, right? – I just want to be sure we’re all on the same page.) The Value field is only used for variables that are not going to be optimized. If the checkbox is not checked, the Start, Step and Stop fields are ignored. It’s all well and good to try optimizing everything, but remember the ST will complete a full test for every possible combination of numbers in each field. So, in this case, it will run the MA1 from 3 to 10 stepping 1 each time (8 iterations) and run the MA2 from 30 to 100 by 10 (8 iterations.) 8 X 8 is 64 executions of the test for the specified date range. That could run for a VERY long time – depending on the date range, the time frame and the speed of your computer. If we were also to test the SLPips and TPPips, we could increase the number of test iterations exponentially. It probably wouldn’t be very pretty. But, if you’ve got an extra computer lying around not doing anything, maybe you could run some pretty exhaustive tests.
Next time we’ll talk about interpreting the results of the strategy tests.
Thanks for your attention and please follow me on Twitter and LinkedIn.
Latest posts by admin (see all)
- Using Simple Moving Averages to clarify the Forex Market - November 13, 2017
- The Huge Benefits of Being a Scalper - November 6, 2017
- The ADX Methodology for Analysis, the Strengths and Values - November 4, 2017
Winner’s Edge Trading, as seen on: