Introduction to Backtesting Strategies
Backtesting is simply the process of testing a trading strategy using historical data so that a trader can see whether his/her strategy has a statistically profitable edge. How to backtest a trading strategy is a vital step that any trader should go through in order to know whether they stand a real chance of making money in the markets.
When a proper backtest delivers good results it also helps a trader to gain confidence in that strategy, which is a huge psychological step in the right direction because confidence helps control the negative emotional aspects that can come with trading.
In this article, we will have a look at the best practices necessary to backtest a strategy properly and the pitfalls that should be avoided in order to achieve the most reliable results possible.
Backtesting Trading Strategies: Best Practices
Trading should first and foremost be treated as a business. Your trading strategy is like your plan on how to make money for your business. A strategy is therefore one of the most important components of your business and should be given the necessary time and commitment needed to prove its worth.
Before we look at the best practices for backtesting a strategy it’s worth mentioning that there are two types of backtesting you can do i.e. automated backtesting and manual backtesting.
Using software to automatically backtest a strategy can save a lot of time and allows a trader the ability to test multiple markets or time frames very quickly. In order for the software to backtest a strategy, a trader would need some degree of programming or coding skills if they want to do it correctly which may be a drawback for most people.
Manual backtesting on the other hand does take more time because you need to manually find and log historical trade setups but doing just that is a great way to learn more about your strategy and to gain confidence in it. It is definitely an exercise well worth doing when done right.
Moving forward we will focus on manual backtesting and the best practices for doing it correctly.
Use a large enough sample size of historical data to backtest with.
The chart above shows 1 year of data on a 4-hour chart of Crude Oil. Backtesting a strategy properly requires at least one year of historical data to test it on and it’s always a good idea to test multiple markets as well.
My strategy requires that I trade the end of corrections within a trend. There are many techniques that I use to do this but on the chart, I used simple trend lines to determine a change in trend and what the current trend is. The black boxes are corrections that my strategy identified and show past tradable opportunities.
Know what your strategy rules are and follow them.
The most recent correction in my sample was an actual trade that I took and planned to trade in advance.
To find the end of corrections I first need to identify which correction could be underway in real time and use market geometry techniques to identify where that correction is most likely to end.
Note that the chart above was a screenshot of where I planned to enter a position to go long.
The price of Crude Oil had other plans on the day and fell right through my original entry zone, which prompted me to look for an alternative entry a bit lower.
Following a set of entry conditions, which are rules-based, I did not have a valid entry signal within my entry zone which moved my focus to find a secondary entry. I got that entry after a minor triangle correction appeared on my 5-minute entry chart (results to follow later).
Test your strategy in all market conditions.
It is important to note that market conditions change all the time and that you should test your strategy in both trending and corrective phases. My strategy requires that I identify a trend and trade the end of a correction which makes my strategy particularly useful in all market conditions.
Log your results (good or bad).
Not all trades always work out. Sometimes you will have losses while at other times you may miss a trade. On this trade setup, I had three targets that were met over the course of more than 24h and the results were great. Keeping a journal is a good way to log your backtest results and should include both the trades that would have worked out and those that did not.
Remember that when you backtest your results assume that you were actually there to have taken that trade. So an important thing to consider when backtesting is logging results during the times you would most likely have been present to trade.
The chart above is that of Wheat, and it was a trade I have been following for a while and which I missed a setup on.
Although price made it into my entry zone it missed my lower blue market geometry line which is a crucial part of my strategy rules which caused me to miss that trade. If this setup was part of my backtesting, I would not have been allowed to log that trade. Remember honesty is the best policy.
Just look at that powerful movement out of that low. Even though I correctly identified what could happen, I never had a setup.
Note all the metrics of your strategy’s performance.
After you have backtested your strategy against a decent amount of historical price action there should be a clear indication as to whether you actually made a profit or a loss. Other important metrics to consider are:
- Did you experience a drawdown and how long did it last?
- What was your average win/loss ratio?
- What was your average risk vs. reward ratio?
- The largest amount of winning trades in a row and the same with your losing trades.
It is important that you know that the performance of your strategy may look great on paper but it does not account for your emotions when it becomes time to trade actual money in a live trading environment where you cannot see the future.
You may therefore have to allow for a drop in the strategy’s performance of around 5 – 10% when you actually go live.
Consider whether your strategy requires tweaking or needs to be scrapped.
If you have been honest about your strategy’s results and they end up not looking that great then it may be time to tweak your strategy or scrap it and start over again. A big mistake that traders tend to make is that they change their strategy rules (or add more rules to it), while they are backtesting, thinking that they can improve its performance.
This will lead to unreliable skewed results, so if you need to tweak your strategy then do it before you start backtesting again and not during testing.
Sometimes the best thing to do is simply scrap a strategy entirely if it fails to produce the desired results. Proper backtesting will take a lot of your time and if the results are not good you may need to go back to the drawing board and come up with a new approach. This is often better than trying to save a strategy that has no edge. Knowing when you are wrong is an important part of trading and those who cannot accept being wrong about their ideas will get crushed in the markets.
Test your strategy in a simulated account
When you do arrive at a strategy that has potential the next important step should be to test it in a real-time environment but in a simulated account. Trading with real money right off the bat is not a good idea and brings a whole host of emotions with it that can undermine your performance.
I honestly believe that if you cannot make money in a simulated account first, then you will surely not be able to make it in a real money account either. You need to allow yourself the time to prove the profitability of your strategy without any real risk. This will give you that added confidence that you will need when you are ready to go live.
Consistency in trading is very important and is why most successful traders took months or even years to develop, backtest and trade their strategies in a simulation account before they go live.
The entire process of backtesting is an important step for those traders who wish to develop their own strategies and have the pleasure of seeing their hard work pay off in the end. Some traders however do not have the time to go through this process and may seek to purchase a proven strategy instead.
The problem with buying such a strategy is that they can be hard to find and even then the success of that strategy relies on the level of commitment that a trader places in understanding that strategy. Allowing yourself enough time to become confident in a strategy’s ability and your own to execute it properly is a crucial part of a trader’s development process. If you would like to know more about how all of this can be achieved then be sure to check out my Trade Forecasts, here.
Backtesting trading strategies and knowing how to backtest a trading strategy properly is an important part of any trader’s success and I would recommend it to anyone who wishes to put their own trading plan to the test.
Until next time,
All the best.