How to Backtest Your Day Trading Strategy
In backtesting, a day trader specifies the strategy that he or she would use and then runs that strategy through a database of historic securities prices to see whether it would have made money. The test includes assumptions about commissions, leverage, and position size. The results give information on returns, volatility, and win-loss ratios that you can use to refine a trading strategy and implement it well.
Start with a hypothesis
You can lay out your strategy as a hypothesis, which may be something like this: “High-momentum, small-cap stocks tend to close up for the day, so I can buy them in the morning and make money selling them in the afternoon.” Or this: “News events take at least half an hour to affect pork belly prices, so I can buy or sell on the news and make a profit.” With this statement, you can move on to the test to see whether your hypothesis holds.
Run the test of your day trading strategy
Say you start with something simple: Maybe you have reason to think that pharmaceutical companies that are moving down in price on decreasing volume will turn and close up for the day. The first thing you do is enter that into the software: the industry group and the buy pattern that you’re looking for. The results will show whether your hunch is correct and how often and for what time periods.
If you like what you see, you can add more variables. Most backtesting software allows for optimization, which means that it can come up with the leverage, position, holding period, and other parameters that will generate the best risk-adjusted return given the data on hand. You can then compare this result to your trading style and your capital position to see whether it works.
Backtesting is subject to something that traders call over-optimization, mathematicians call curve-fitting, and analysts call data mining. Although over-optimization sounds great, what often happens is that the test generates a model that includes unnecessary variables and that makes no logical sense in practice.
If you find a strategy that works when the stock closes up one day, down two days, then up a third day, followed by four down days when it hits an intra-day high, you probably haven’t made an amazing discovery; you’ve just fit the curve.
Compare the results with market cycles
When you backtest, be sure to do so over a long enough period of time so that you can see how your strategy would work over different market conditions. Here are some things to check:
How did the strategy do in periods of inflation? Economic growth? High interest rates? Low interest rates?
What was happening in the markets during the time that the strategy worked best? What was happening when it worked worst? How likely is either of those to happen again?
How does market volatility affect the strategy? Is the security more volatile than the market, less volatile, or does it seem to be removed from the market?
Have major changes occurred in the sector over the period of the test? Examples of these types of changes include new technologies that increase demand for certain commodities or changes in regulation that make industries obsolete. Does this mean that past performance still applies?
Have there been changes in the way that the security trades? For example, the bulk of trading in most commodities used to take place in open-outcry trading pits. Now, trading is almost entirely electronic. How do your test results look given current trading technologies?