Introduction to Backtesting

Adrian Reid explains backtesting for systematic trading: testing strategies on historical data to build confidence and filter out fragile ones. The core catch is that past results don't guarantee future performance, and overfitting to historical data can make strategies look better than they actually are.
Chapters
Have you heard about backtesting and trading, but wondered what it actually is? My name is Adrian Reid. I'm the founder of Enlightened Stock Trading. And in this video, I want to give you an introduction to backtesting and trading. Explain what it's all about, how it works, the benefits and purpose, and also the limitations of backtesting. Because like everything, backtesting is not the be all and end all. It's not the one thing that's going to make or break your trading career. But it is one of the most important skills that you can learn as a systematic trader. But before we go any further, make sure you hit the subscribe button and give this video a thumbs up so that you get notified of all of my future videos, because I've got new trading content coming out all the time and I don't want you to miss a thing. So, first of all, what is backtesting? Well, simply backtesting is when you take your trading rules, the rules for your trading strategy, and you apply them, typically using a backtesting software to pass data. And what you're trying to do is generate all of the signals that your trading strategy would have generated in the past and evaluate how profitable those signals were in the past. Now, the reason you want to do this is to determine whether or not that strategy is actually good enough to trade real time going forward into the future. Let me ask you this because one of the most common questions or challenges I get about backtesting is, yeah, Adrian, but that's great. That's on past data. And the future is, is not the same as the past. So backtesting is irrelevant, right, because it's in the past and it doesn't apply to future trading conditions. And my response is, that's absolute crap. Because let me ask you this. Would you rather trade a strategy that showed you a profit over 30 years of backtesting, or would you rather trade a strategy which showed massive losses over 30 years of backtesting? I mean, the choice is obvious, right? There's no reason to expect that a strategy that lost money in the past would miraculously turn around and start being profitable just because you started to trade it. So if you think that backtesting isn't relevant because it's on past data, that's absolutely a mistake. Because the big question you're trying to answer is, will my strategy be profitable? Now, backtesting can't tell you definitively will it be profitable, but what it can do is help you put the odds or tilt the odds in your favor. If the strategy was unprofitable in the past, it's not going to be profitable in the future if you backtest over a long enough time period. So if you backtest your strategy and it didn't make money in the past, don't trade that strategy in real time in the future because you're unlikely to make money now. If you backtest your strategy and it did make money in the past, there's a chance that it could continue to make money in the future. Now, how do you improve that chance by backtesting correctly? By doing deep analysis that I'll talk about in the rest of this video series and on the blog post below. If you're on my website, backtesting correctly really tilts the odds in your favor. So what you're trying to do is maximize the probability that you're trading a profitable strategy. And backtesting helps you eliminate bad strategies by identifying that they lost money in the past. Also helps you eliminate fragile strategies by showing you whether or not those strategies work over a wide range of market conditions and parameter values. We'll talk about that more later in this video series. And it gives you the confidence that your strategy is likely to work in the future. So that's what backtesting is in trading. So the benefits of backtesting are really that first of all, it gives you confidence. If you know that your strategy was profitable in the past, there's a chance it will be profitable in the future. Secondly, it prevents you from trading bad strategies. If the strategy lost money in the past, don't trade it with real money in the future. It also helps you understand the dynamics of how the strategy works, because one of the biggest challenges traders face. Pardon me, One of the biggest challenges traders face is not being comfortable with how the trading strategy works. So if you know how many losses in a row you could get, how long your winners are going to last, how big your winners are going to be on average, how long your losers are going to last, how big the losers are going to be on average, the frequency of wins and losses, all of those statistics about the performance of your trading strategy, then it's much easier psychologically to follow that strategy because you're prepared for what's to come. So backtesting not only tells you about the historical profitability of the strategy, it also tells you what to expect when following the strategy. And if you know what to expect and you have confidence that it's profitable, then your ability to stick to that trading strategy as a trader is dramatically improved. And this is one of the biggest benefits of backtesting because it shows you exactly how that strategy would have played out day by day, week by week, month by month over the past 30 odd years that you've backtested it for. And that level of insight into the trading strategy you're using will increase your ability to follow it and remain confident dramatically. So that's one of the biggest benefits of backtesting. What are the limitations of backtesting? Well, probably the biggest limitation is that it's on past data. So just because it backtests profitably doesn't mean that it's going to be profitable in the future. It increases the chances, it tilts the odds in your favor. But there's good backtesting and there's bad backtesting. So let me give you an example. If you have a trading strategy, let's say that uses two moving averages, maybe three moving averages even, and you code that strategy into your backtesting software and you test every possible combination of those three moving averages and you test, let's say you test 300,000 different combinations of, of parameter values for that trading rule and you come up with the one combination that over the last 20 years happened to work the best. Then you say, okay, cool, I've got this great trading strategy. The equity curve looks amazing. I've got really profitable trading results. Let's start trading that in real time. Chances are as soon as you start trading that in real time, you're going to lose money. Why? Because you didn't backtest correctly. What you did was, was look for the historically best parameter values and you applied those to the future. What you didn't do is validate. Is that system stable over time? Is that system robust across a wide range of parameter values?
Is the edge of that system stable? As in, is it eroding or.
Is it growing over time? Is the volatility of the system increasing and therefore getting more and more dangerous? You don't want to backtest just to optimize profit or just to improve the equity curve. You want to back test to eliminate or reduce the possibility that the strategy is bad, failing or about to fail. So the limitations of backtesting really come about when you don't backtest correctly. And how do we backtest correctly? I'll talk about that more later in this video series. But for now, what I want you to understand is that backtesting and optimizing are two different things. You don't want to put your rules into your backtesting software and just hit, optimize blindly and trade the parameter combination that comes out best. That's poor backtesting and it will expose all of the limitations that backtesting comes with. What you want to do instead is use backtesting as a tool to really interrogate and investigate the performance of your training strategy. As a trader, the more you understand about how that strategy will work, the better off you're going to be, the more confidence you're going to have and the more likely it is that you're going to find any problems or challenges with that strategy and address them before you lose money in real time. So this is the introduction to backtesting we've covered. What is backtesting and trading, the purpose of backtesting, some of the benefits and some of the limitations. In my next video on this series, going to talk about the difference between back testing and other methods of analysis. So if you want to watch that video, click the link that's coming up next or scroll down if you're on my website and I'll see you in the next video. Bye for now.
It.











