The Importance of Testing with Tick Data

Before I go on to further testing, I just want to do a short write up on the importance of knowing what your data represents and ensuring that it is good.

Using MT4 as an example, a normal Strategy Tester run using the standard historical data will give you 90% modelling quality. 90% sounds good – in a modern world, scoring a 90% on a quiz means you get an A+ – but MT4 testing does NOT work that way.

One important thing to know about the standard data you download from MT4 is that it is using interpolated data. What this means is (broadly speaking):

MT4 takes 4 price points – bar open, bar high, bar low, bar close – and then – for lack of a better team – estimate how prices move based on these 4 price points. If you have ever plotted points on a graph and try to draw the “best fit” curve to fit those points, you know what MT4 is kind of doing with the data.

The problem is, of course, prices do not move in a predictable “best-fit” manner that can be estimated with a software. Real price movement can be very hectic even within a single bar. If you use interpolated data in your testing, you are effectively using estimated, “predictable” prices to gauge if a strategy will work or not, instead of using real price tick data. Most strategies perform better when prices are more predictable; and do much worse when using more realistic prices.

To illustrate with an example, I ran a quick backtest with the Bolinger Band Strategy from my last post [ http://asimovanalytics.com/2020/11/prelim-test-bollinger-band-strategy/ ] but using the default MT4 data.

(sorry for the small text – but you can see the equity curves in these examples)

The results? Well, it sucked, but not too much. We’re almost back at breakeven. The curve is actually pretty smooth after the series of losses in the middle – you can imagine that we will be turning a profit in about a couple more trades.

Next, we do the same test, same period, same settings, but now with proper tick data with variable spread and slippage factored in:

AND IT TOTALLY BOMBED.

Now imagine if you were to do your backtests using the default data instead of tick data, took a strategy that looks good on that, and went on to trade real money with it. I think you understand the risk involved at this time.

The next question is, how do we get proper Tick Data?

If you are keen, I would recommend Tick Data Suite from [https://eareview.net/tick-data-suite]

They have quite a number of good things going: they offer data from various sources; including Dukascopy tick data which is generally considered the gold standard. If you prefer data sources from elsewhere, you can get data from FXCM as well, amongst others. You can see from the screenshot above that it also lists all the data you downloaded in a nice, neat list, making it easier to manage than even MT4’s own interface.

Once installed – it automatically and seamlessly integrates with MT4, so no headaches on that end.

As you can see, the “Spread” option – instead of having you choose a fixed number now becomes “Variable” – to reflect the spreads more accurately according to what actually happened in the markets.

There’s also a selection of additional settings, but the most important one, I feel, is the ability to factor “Slippage” into your backtests. As you can see below – the slippage settings I use is pretty crude – there’s a 20% chance I will get 10 points in my favour, and a 80% chance I will get 30 points against me – each simply evens out to an additional 2 pips lost per trade.

It is basic, but it’s just the one I use. There are more sophisticated options to simulate slippage as well.

Basically – I find it a great tool to use, and a must-have if you are planning to automate your trading using MT4. The price point is quite reasonable a swell, a $97 upfront payment with a $10 monthly subscription.

You can find Tick Data Suite here:

https://eareview.net/tick-data-suite

[Bollinger Band Strategy] A Preliminary Test

I did a preliminary test run for a Bollinger Band trading EA I made using fxDreema recently. This is a quick write up of what we found.

  1. The Strategy

The Bollinger Band trading strategy is quite common and easily googled. The variant I am testing for is the breakout variant –

  • Buy Long when candle closes below the lower band
  • Sell Short when candle closes above the upper band
  • Stop Loss to set at a multiple of ATR-14
  • Close trade when price crossover middle-line

With these rules, the things we can change in this strategy are:

  • Definition of the bands:
    • Length/ Number of periods
    • Standard Deviation
  • ATR-14 multiple used for stop-loss

We technically can also test for the shift or offset for the bands but we’ll leave that out for now

For each of these 3 parameters, I test for about 5 values, for a total of 125 possible permutations.

Parameter: (starting value, step, ending value)

Number of Periods: 10, 5, 30

Standard Deviation: 1, 0.5, 3

ATR multiple: 1, 0.5, 3

  • Pairs and Timeframe

It is my belief that common strategies do work; but they work better on higher timeframes. So I will test this on the daily timeframe on 7 major pairs:

EURUSD
GBPUSD
USDJPY
USDCAD
USDCHF
AUDUSD
NZDUSD

I ran the optimization over the recent 2 years 2018 -2019. I am aware that testing for 2 years on a daily timeframe isn’t going to produce runs that have a lot of trades, so I keep that in mind for now.

  • Spread and Slippage settings

Tick Data Suite comes with a Variable Spread option that tries to emulate the spread of a FX pair at the time you are testing – so I will use that option.

The more important thing is Slippage – and this is going to differ greatly; but I assume:

                20% of time, slippage can be 1 pip in my favour
                80% of time, slippage can be 3 pips against me

Which is just a fancy way of saying I am getting an additional 2 pips against me on every trade on average. I am using this for all pairs which may or may not be perfectly accurate.

  • Preliminary Results

With the above definitions in mind – let’s look at the first results:

My first instinct is this strategy looks promising – apart from USDCHF and NZDUSD, almost every other pair has at least 30% winning passes – especially EURUSD/ USDCAD where the winning passes are > 80%. Once again, only 2 years on daily timeframe, so number of trades is quite low, but still a good sign.

The next thing to look for is: out of all the winning passes; how many of them can get a Profit/ Max drawdown ratio of at least 1? (this means profit > amount risked in the period)

This part gets interesting – for USDCAD, even though 104 out of 125 passes are winning, none of them pass the P/MDD > 1 ratio. In fact, only EURUSD and USDJPY showed some promising results of that – out of all the winning runs, there are still quite a number of runs where P/MDD > 1.

The Next Step

SO with this, the next step will be to do more testing on EURUSD and USDJPY for this strategy.

This includes:

  • Testing over a wider range of period that covers more varied market conditions
  • Walk-forward testing

Stay tuned for more updates!

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!