main

9. Back Testing

The art of trading back testing

As I’ve mentioned before, one of the things I really love about trading is that, unlike any other business, you can fully test your ‘business model’ (trading plan) without risking any real money. In trading, this assessment process is called back testing.Back testing is the area now most neglected by traders.

I’ve talked about the importance of psychology and money management in previous chapters – and so have a lot of other trading coaches. So much so, there is now a bevy of information and awareness around.

You only have to surf the ‘net to see just how much focus is placed on these areas – as there should be.But all this attention seems to be at the expense of back testing. As a result in trading back testing, I think, has now become the new least understood and appreciated area of trading.

Why is back testing so important?

Trading back testing is most important because it directly impacts on your entries and exits, money management and psychology in the following ways.

Entries and exits – back testing enables you to test your entire system’s performance using historical data. With that information, you can make the necessary adjustments to produce the results you’re looking for.

Money management – back testing allows you to test various money management models to see which works best with your system.

Psychology – as discussed earlier in the book, understanding your system’s strengths and weaknesses – even if they are only on paper – will improve your trading confidence. This will have untold effect on your performance when you begin to trade for real.

Whatever technical analysis criterion you use to trade with – be it moving averages, candlesticks, volatility breakouts, Fibonacci retracements or any other trading system – you’re going to need to back test it thoroughly, in order to remove any possible doubt about it’s capability.

Without trading back testing, a lack of confidence arises and usually forces traders to question their own trading systems.

They give in to the temptation to modify their trading plan… often with devastating consequences. This temptation typically comes from a string of losing trades or an opportunity to replace their trading system with a new whiz-bang indicator that is the latest fad talked about in chat forums.

Anything that sounds too good to be true will attract the attention of a trader who is not satisfied with her trading system, simply because she has not properly tested her system in the first place. She has not built up the necessary confidence needed to successfully trade the system she has developed.

Will my trading strategy be profitable?

This is the most asked question in the trading world. Author Mark Jurik had a go at answering it in his book Computerized Trading, as shown in Box 9.1.

But what is trading back testing exactly?

Trading backtesting is the process of testing a trading strategy using historical data rather than testing it in real time with real money. The metrics obtained from testing can be used as an indication of how well the strategy would have performed had it been applied to past trades. Interpreting these results then provides the trader with sufficient metrics to assess the potential of the trading system.

Logically, we know that the results from this type of testing will not be able to predict future returns with pinpoint accuracy; however, it can provide an indicator as to whether you should even pursue a trading system or not. What’s more, if you decide to go ahead and trade the system, it will give you guides on what to expect.

But the question remains: how can you test a trading system’s performance over time?

There are only two ways to do this – manually or with computer software. To be honest, computer software is the only ‘real’ option. I have tried both testing methods and manual testing is not only time consuming but very hard to replicate and test effectively.

The benefits derived from trading backtesting software cannot be overestimated. It will save you time and provide an endless opportunity to fine-tune and test your system.

A small outlay in capital to purchase good back testing software will potentially save you thousands in the market; it is a very wise investment if you are considering designing a successful and mechanical trading system.

Mechanical back testing

Please understand, as long as your mechanical trading system exclusively works with price data (open, high, low, close, volume), you will be able to use back testing software.

For example, say you create a mechanical trading system with the following entry rule:

Rule: Purchase a security when the 10-day moving average of closing price crosses above the 30-day moving average of closing price.

This rule can be tested quite easily over historical data. On the other hand, your buy signal rule may be a little more complex such as:

Rule: Purchase a security when the 10-day moving average of the closing price crosses above the 30-day moving average of closing price and the PE ratio was 75% or lower than its value three months before.

This rule introduces data that is not often supplied or maintained in a database of price information.

To successfully back test this would involve obtaining historical data of a security as well as the price-to-earnings ratio (PE ratio).Typically, historical data on a group of equities would only include the open, high, low, close and volume for each period. Because of this limitation, many mechanical trading systems are designed around purely price technical indicators.

Unfortunately most mechanical trading system based on fundamental data is beyond the scope of retail investors due to the lack of historical data available to conduct a complete trading back test.

Back testing software

Fortunately, these days, many charting packages have back testing software built in. If you followed the process for selecting a charting package in the previous chapter, you should have either found one with back testing capabilities included or found one that is compatible with another off-the-shelf package.

It can quickly back test and evaluate a trading system, whether a single security or a multiple-security portfolio.

I believe tading back testing is the only way to remove self-doubt. Once you have established that you have a reliable and robust trading system only then will you be confident in trading it.

Similarly to your charting software, make sure you know your package back to front. You won’t be able to get the best out of it unless you fully understand how it works and what you can do with it.

Alternative Solutions

Sadly, I have seen many clients never quite ‘get it’ with regards to back testing. For many, back testing software is simply too technical.If you fall into that category, don’t give up. It’s a critical step in the system design process.

It’s easy to use and perfect for analysing your system before trading it real time.

Important note: If you find yourself testing and re-testing in the hope of stumbling across that silver bullet, remember, you will never create a trading system that has a 100% success rate. Many have tried (myself included) and everyone has failed.

You should be looking for a good trading system with minimal drawdown and a good risk-to-reward ratio.Many trading systems have more losing trades than they do winning and yet they still make money. How? Money management. (See chapter 6.)

The final piece in the system-design jigsaw puzzle is to take the trading system you have designed in the previous chapters and test it.By testing your systems you have just put yourself among the top 1% of traders, ensuring your success. Congratulations!

6 Responses to 9. Back Testing

hi david, have come across a lot of your work on the web. and it’s been really useful and well presented. thanks. just came across this article of yours on backtesting.

a quick question if i may. i’m looking to get something like metastock ‘end of day’ to help develop the trading plan and do some backtesting etc but to do any scanning, backtesting i’ll stick my neck out and say that i probably need some data…

my online broker (comesc) allows me to export limited data (eg data for a period of time for 1 stock or 1 days data for all securities). neither of which is really that comprehensive. how to best get where i need to go? do traders buy it from somewhere, build it up over time?

Have you checked out Portfolio123? For 50 bucks a month you screen for fundamental and technical variables, backtest it, do robustness checks (random entries hundreds of times to ensure you are not cherry picking the results), and simulation testing with seperate buy and sell rules, slippage, custom universes, blah, blah, blah.

You can use it for 45 days as a free trial if you use the code HKURTIS when signing up to test it out. Before Portfolio123 I thought only Zacks Research Wizard was a low cost alternative – but hundreds of dollars for the watered down version, survivorship bias, and other problems – no thank you. IMO its institutional grade software for about 1/20th the cost.

Hi Dave,
I happened to read this excellent aritcle. In Metastock, I would like to book profit for only half my position and I could not find a way of doing this. Could you please let me know whether such testing is possible in Metastock.
Thanks and regards
Jesuraj