What is a Backtesting in Trading?

Line chart with area.

We all have already seen amazing backtesting in trading: 99% are false! This is the first article of a series that will explain to you, what is a backtesting in trading? Why is it so important (especially in algorithmic trading)? And how should you do a backtesting in trading? Spoiler alert: not in the way you are thinking…


Basically, a backtesting in trading is here to understand the behavior, the performance and the risk of a trading strategy. To do so, you will take a trading strategy and apply it to historical (or generated) data. Depending on your trading strategy, you will focus on many backtesting metrics, but the most used backtesting metrics are:

  • Return / year: you take the average return per year you are backtesting your trading strategy.
  • Drawdown: The drawdown will give you the worst diminution of your net value (if your highest capital was 15,000$ and now you are now at 10,000$, you have a drawdown about 1 – 10,000/15,000 = 33%. It is the most used metric to understand the risk.
  • Sharpe ratio: This metric, very well known in finance, will give you the additional return obtain by increasing your risk of 1% (if your Sharpe Ratio is about 2, it means that, when you are increasing your risk by 1%, you are increasing your return by 2%)

Figure: Example of an output from a backtesting in trading

Backtest of a trading strategy using Python. It show a clear upward trend in the results
Max Drawdown
Return / year
Sharpe Ratio
-12.87 %
33.61 %


You can take the same strategy on the same data and show me an amazing backtest which is exactly what people on copy trading or bot selling platforms do 99% of the cases.

I can take the same strategy on the same data and show you that this strategy is overfitted, not profitable and only good for the trash… But why? Backtesting in trading is a scientific process. Indeed, some people take 10 years to master this field totally, and I will explain to you all you need to know about it in this series of articles.

The most frequent reason why all your backtests are good is that you are using the backtest like a research tool. But, in reality, you should use it only once per strategy, at the very end. The goal is to say if yes or no we need to go deeper into the trading strategy building process. (I will give you the worst backtesting mistakes in the next article).

Join Our Newsletter

Be the first to receive our latest quant trading content (personal notes, discount, new articles).


What does it mean “Stock prices are random”? It means that the variation that a stock price will occur is totally random. It doesn’t mean that we can’t predict the distribution of this randomness… We will not go deeper into that in the backtesting section, but it is important to keep it in mind.

In other terms, the past could be different. If the COVID-19 has never been discovered and we all thought it was just like a simple cough, we would not suffer from this micro financial crisis. If the COVID-19 hadn’t stopped our economy, the countries would not have to borrow money, which didn’t make the inflation increase and so on…

Figure: Possible past values for the asset price

different stock prices without any signification, there are here only to highlight the randomness of stock prices

All of that to explain to you that, during your backtest period if you are using only the historical data, you will never be able to have a large overview about how your strategy can work on different market conditions: bullish market, crisis, economic changes…

You need to use the historical data to simulate different situations: it is the simple path versus multiple paths backtesting problem.


The simple path backtesting method is easy to understand taking the historical data, apply your strategy on it and analyze the graphs and the metrics you are obtaining. Of course, the only precaution you need to take (like for the multiple paths method) is to never backtest your strategy on data you have already seen.

It means if you took the 2015-2020 to understand that the doji chart pattern works well when we are into a consolidation zone, you can’t backtest the strategy you have created on the 2015-2020 data, because obviously the performances will be amazing because you have used this dataset to do your research: Backtesting is not a research tool!

Backtesting in trading is here to validate (or invalidate 95% of the cases) a strategy. So, you need to use the remaining data to test your trading strategy: from 2020 to 2024.

The problem of that approach is that you will take the historical data path only, which is only one possible path that the past could be!


On the other hand, the multiple paths backtesting can be done in several ways: taking the historical data in a different order creating several datasets like for the walk-forward optimization or for the robustness testing or you can generate new data like for the Monte-Carlo simulation method.

Personally, I combine all these methods and much more to create a score to my strategy: the more the score is close to 10, the more the strategy is amazing (robust and profitable).

Figure: Example of an output from a CPCV (robustness testing)

Robustness test of a trading strategy using Python.

But, let me define quickly what I mean by robust. A robust trading strategy is a strategy that will not see its performance varies too much when we modify some parameters (like an elasticity in economy): let’s assume I’m using a 100-period SMA, and the performance is amazing. If I take a 99-period SMA without changing anything else and the performance becomes awful. It means that the strategy is not robust because a small change can ruin your strategy.

Indeed, if your strategy performance depends on a tiny modification like that and we know that the future as the past is random, how could we imagine that this strategy will be consistently profitable in the long run?

In basic word, the multiple paths method is like splitting our database in several datasets and we apply the single path method on it, then we aggregate the results to understand the standard deviation from them: the more they are different on different datasets, the worst it is.

I hope this article gives you a quick overview about the complexity of backtesting in trading. It is far most advanced than applying your trading strategy on historical data… In the next article, we will explain the biggest backtesting mistakes that 99% of the people do.

👇🏼 Join the newsletter to be informed when the next article of the series will be issued 

Join Our Newsletter

Be the first to receive our latest quant trading content (personal notes, discount, new articles).

Lucas Inglese

Lucas is a self-taught Quantitative Analyst, holding degrees in Mathematics and Economics from the University of Strasbourg. Embarking on an independent learning journey, he delved deeply into data science and quantitative finance, eventually mastering the disciplines. Lucas has developed numerous bots, sharing his insights and expertise on LinkedIn, where he regularly posts content. His understanding and empathy for beginners in this complex field led him to author several books and create the comprehensive “Alpha Quant Program.” This program offers e-learning videos, monthly projects, and continuous 7-day-a-week support. Through his online courses and publications, Lucas has successfully guided over 67,000 individuals in their pursuit of knowledge in quantitative finance.

Related Posts

Scroll to Top