Backtesting
Once you’ve decided how you want your strategy to look in terms of screens and horizons, you have to backtest it. To backtest a strategy is to see how it would have performed had it been implemented historically in the past.
For example, if your strategy were to buy stocks with PE ratios between 0 and 10, rebalancing every week, you would need to go back to each week historically, see what stocks would pass the screen, and hold them equally in your portfolio. At the end of the week, you would sell all the stocks and reinvest the proceeds into the new stocks that would pass your screen for the next week. Along the way, you would keep track of the cumulative returns to the strategy. The results of your backtest would look like Figure 1.2.
Figure 1.2 Backtest of 0 to 10 PE strategies
These are results from Equities Lab. The darker (lower) line is the return of the S&P 500; the lighter (upper) line is the return of your strategy. We discuss how to use Equities Lab to generate these types of backtests in Chapter 2, “What You Need to Start Investing Using Quantitative Techniques.” Before that, I want to point out a few things about the backtest results. In this particular case, I chose a ten-year time period over which to backtest. At the beginning of each week, Equities Lab chooses all stocks with a PE of more than 0 and less than 10 and creates a portfolio, holding an equal amount of each stock. It holds this portfolio until the end of the week and then sells all holdings, reinvesting the proceeds equally into the stocks chosen by the screen for the following week.3
In this backtest, you are looking at the returns to a trading strategy following the screen compared with the returns to the S&P 500 index. Over the ten years, $100 invested in this simple quantitative trading strategy would have returned about $275 in profits.4 The same $100 invested in the S&P 500 would have returned about $110 in profits.
And just like that, you have your first quantitative equity investing strategy. You will invest in stocks that have between 0 and 10 PE ratios, rebalancing your portfolio each week. Doing this historically would have outperformed the market by a healthy amount over the last decade and if this pattern continues over the next ten years, you’d be rich! Richer, anyway.