How I Do Preliminary Testing

When we first get a new EA; we need to backtest it to make sure the trading idea is solid and really works in the markets, no matter how good the idea may sound on paper.

  1. Make sure the Code works

Using MT4 as an example; the first thing I do is to run a test through Visual Mode: and make sure all the trade entries and exits occur when I expect them to. If not, we need to find out why exactly trades are not triggered according to the specifications. There could be multiple reasons why this occurs – either the code is really faulty, or my interpretation of the EA’s rules itself needs to be refined.

2. Choice of Parameters to test for

The next step is a bit more general: I would take a look at the EA and try to determine which parameter inputs will have most impact on trading results.

There’s a systematic way to do this; but at this stage I’ll just wing it and go with those that seem most important.

For example: if I am testing a Moving Average cross EA, I’ll maybe choose the MA inputs to the most important things that affect profitability. The truth is it is entirely possible that your Stop Loss and Take Profit settings will impact your results in a huge way as well – but for a prelim test I’ll let that slide.

I may choose like 2-3 parameters that seem important, and also reasonable starting / step / ending values for them. Keep the number of values to test for each parameter roughly constant – if I test for 5 values for Moving Average 1 (eg, 10,20,30,40,50), I should also test for about 5 values for Moving Average 2 (eg, 60,70,80,90,100) and not like 20 values.

3. Testing!

 Finally, I run an Optimization run for maybe about 2 years of data over the 7 major forex pairs. MT4 optimizations take time to run; so I don’t get too overboard and optimize over a long time like 5 to 10 years. For EAs; I start with Daily timeframe – most EAs are built using simple rules – and it is my belief that simple trading systems work best on higher timeframes where there are “less noise”.

The issue with daily timeframe is that you need a longer testing period to generate enough trades to be more confident of the results, so the initial 2 years may not be enough. It’s fine for now – if the strategy cant show promise even over a shorter time period, I don’t think it’s going to show much improvement if I change the period to five years or more.

4. First Interpretation of Results

After exporting MT4’s Optimization Results to excel; I first take note of the following:

  • What is the % of winning runs over the total number of runs? A sound trading strategy should not be dependent on having exactly the correct set of inputs to be profitable; ie – it should be good over a wide range of parameter sets. In this case, at least 30% of your passes need to be profitable, or there might be something fundamentally wrong with the trading idea.
  • On a similar note; good trading ideas also ought to work over a wide range of markets. If something is only profitable on say, USDJPY and not on any other pair, there needs to be a really good explanation on what makes USDJPY so special with regards to that strategy – else it might just be a fluke.
  • I don’t really look at profit factor – but instead, I use a calculated metric: Profit/ Maximal Drawdown (or PMDD). The higher this number, the better, but we are looking for results where there are many instances where PMDD is more than 1 – what this means is not only your pass is profitable, but also the profit is more than the potential losses in that same period.

And that’s about it – these are just meant to be a prelim test, I’m basically just seeing if a strategy has the potential to be good or not, so my criteria isn’t too stringent at this point – in fact it’s actually quite lax. If it passes this stage, we can go on to see if there’s any scope to further development – but if a strategy doesn’t even look good here, chances are it wont look good under closer scrutiny as well.

The main point is – evaluating a strategy / EA isn’t as straight-forward as just running a backtest for the past X number of years and see that it generates a profit – there’s a bit more nuance than that.

I hoped this article is useful to you – thanks for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *