Backtesting is your shortcut to gaining experience
It's the only way to discover the ultimate truth and develop instincts that will open many doors for you.
There comes a period in every market cycle when every Tom, Dick, and Harry is building a trading strategy, claiming theirs is the only strategy you need to succeed. But then, someone like you, who’s a tad smarter and a lot more skeptical, would come along and ask a simple question: “How do you know this strategy is perfect?” This leads to two outcomes: either you end up believing the person and adopt their magical strategy, or you decide to dig deeper to discover the facts and talk some numbers.
Backtesting is your quest to discover the ultimate truth about markets. It's unfortunate that backtesting cannot be applied to real life because, if it could, many people would have changed their choices and avoided their doom. When you choose to backtest a hypothesis, you are essentially walking the path of discovering eternal truth. This truth could either comfort you in the end or lead to new revelations that shock or disappoint you.
My apologies for sounding like the Osho of trading, but I want you to understand that backtesting isn’t the destination; it merely reveals the truth about your hypothesis. What you do with that truth is up to you.
It all starts with a simple hypothesis about a potential trading strategy: when to buy and when to sell. When you build a hypothesis, there are no complexities, which is what trading is all about at its most fundamental level. But your hypothesis isn’t the truth. What you consider golden isn’t golden until it’s backed by time. You go back in time and test the same hypothesis under evolving market conditions—good or bad—and see how it holds up.
Why do we backtest, though? What’s the point of looking into the past when the market is an ever-evolving beast? What happened in the past might never repeat in the same way because the participants and the times will be different. The answer is simple: you build a strategy so you can mechanically execute it for years and make money. But how do you know it will work in the future? If the strategy has survived for years in the past, it’s more likely to survive in the future.
The primary reason for backtesting is to go back in time far enough to cover all kinds of market phases and volatile periods. What’s the worst that could happen? What’s the best that could happen? The worst that could happen is called drawdown, a simplistic way of discovering how much you stand to lose in the worst-case scenario. The method for finding that out is mathematically beautiful: you go from the best phase of the strategy to the worst part, and the widest gap is your maximum drawdown.
For a new trader, this is a fascinating concept. They’d see the backtest result of the last few hundred trades, discover the maximum drawdown, and bet their house on a mortgage to outclass Jim Simons, only to realize their strategy isn’t robust enough. They didn’t know everything about the strategy.
Your maximum drawdown will always be breached because, as the market evolves, so will the volatility and the risk associated with the strategy. You can never consider your past maximum drawdown as the ultimate truth because the nature of truth lies in evolution. So, what’s the solution to this conundrum? The beauty of mathematics lies in its ability to formulate multiple realities.
You build a simulation where you insert past data, run the strategy for ten years' worth of trades—say 1,000 or 5,000—and see what happens. This is called a Monte Carlo simulation, or you can call it the multiverse, where you test your strategy in multiple realities and discover the worst-case scenario. The worst of them all could be your maximum drawdown, which serves as a good starting point since you've already accounted for black swan events like COVID-19 or any financial crash.
You might be wondering, “Why the hell should I go through all this rigmarole? What if I spend hours backtesting only to discover my strategy is garbage because it only looks good in the present?” This is the most common outcome for beginners who backtest strategies they thought were the holy grail.
Backtesting not only enables you to find the truth about certain strategies, but it also exposes you to ever-changing market conditions. Everyone can parrot that trend-following strategies fail in choppy markets, but what is a choppy, range-bound market? What does that phase look like? How do markets behave in such a phase? And most importantly, how does the transformation from trending to choppy occur and vice versa?
When you go through the charts to discover the truth about your hypothesis, you inadvertently expose yourself to varying market conditions. I’ve tested all my strategies manually since 2010, and that’s how I developed the idea of following the trend and how position trading is more rewarding despite the fear of opening gaps in the opposite direction. Your brain will recognize different combinations a move could materialize in the market, training you to think in all possibilities rather than sticking to one way of thinking.
Imagine going through market charts from five years ago. You will understand the important factors that created turbulence and learn about the trends that emerged from simple factors. Systematic backtesting gives you all the data you need about your hypothesis, but it doesn’t provide exposure to each trade. It gives you confidence in your strategy but doesn’t help build your psychology.
One might wonder what to do with all the backtested data at hand. What metrics are important? What ratios should one focus on? And how do you make sense of the ocean of data? I firmly believe that your worst-case scenario, profit factor, and average risk-to-reward ratio are the only factors worth focusing on in backtest results.
While drawdown shows your worst-case scenario, the profit factor shows how much you earn for every rupee/dollar you bet. A profit factor above 1 means you will make money, although the closer you are to 1, the higher the chances of breaking even after charges. Ideally, the profit factor should be around 1.5 to 2.
To calculate the profit factor, you sum up all your profits and losses and then divide profits by losses. For instance, if your total profit is 25,000 points and your total loss is 15,000 points, your profit factor will be 25,000/15,000 = 1.66. This means you make 1.66 for every rupee/dollar you bet.
To calculate the average risk-to-reward ratio, you take the average of all your losses and profits and do the same math. For example, if your average profit is 140 points and your average loss is 65 points, your average risk-to-reward ratio is 140/65 = 2.15.
When you estimate your worst drawdown through Monte Carlo simulation, have a profit factor of 1.66, and an average risk-to-reward ratio of 2.15, you can be assured that you’ll recover from drawdown if you’ve backtested enough and used Monte Carlo simulation for more than 5,000 trades.
Backtesting is about discovering the truth about your strategy. It’s also about learning how a strategy evolves through different market cycles. Through backtesting, you gain the confidence to punch hundreds of trades, knowing you’ve stress-tested your strategy by simulating the future. More importantly, the math checks out, and there’s a higher probability that you’ll come out winning if you stick to the strategy long enough.
In the end, backtesting not only reveals the core truth about any trading system but also helps you develop the resilience to take seven to ten losses in a row without worrying about the next trade because you have a deeper understanding of how to emerge from a losing phase. That’s your trading psychology right there. Your confidence comes from rigorously facing the worst-case scenario, curing your anxiety about the future.