Everything you need to know about backtests

When you discover trading bots, you immediately want to know what the results will be. Even if it is not possible to guarantee results, we can still use tools to try to predict the behavior of a strategy. In this article, we will present backtests, one of the most well-known tools!

What is a backtest ?

A backtest is a test into the past. When we backtest a trading bot, we will test the behavior of the trading bot on the data of the last 3 days, the last 6 months, even the last 3 years with virtual funds. So there is no risk. A backtest allows us to answer the question “What would my trading bot have done if I had launched it 3 days ago, 6 months ago, 3 years ago“.

Here is an example of a backtest running on the Botcrypto platform, with the vortex-bull strategy that you can import for free from the strategy store. I have configured the backtest to test the strategy over the whole year 2020 on the bitcoin/euro pair on the Kraken trading platform. You can see at a glance the different moments when the backtest bought and sold.

Example of a backtest with the vortex-bull strategy on Botcrypto
Example of a backtest with the vortex-bull strategy on Botcrypto

Why you need to do backtests ?

Backtests provide a lot of information on the effectiveness of a strategy, and answer a number of questions:

  • Has the strategy been properly configured?
  • Is it effective during the test period?
  • What are its characteristics during the test period?

You can usually see many statistics and details of all orders. Here are the details of the previous backtest. There can be global statistics, such as profits made or success rate. You can also see the details of all orders, including the fees taken (virtually) by the exchange.

The detailed interface of the results of a backtest on Botcrypto
The detailed interface of the results of a backtest on Botcrypto

This allows you to check whether the strategy is effective during the test period. Did it take losing trades? If so, how to avoid them? Is it sensitive to fees? With this information, you can modify the strategy to improve your results.

What are the limits of backtests?

First of all, it should not be forgotten that a backtest only tests a strategy over a given period of time. The results are therefore not universal, and if your backtest took place in an uptrend, it does not give any interesting information for a downtrend. Therefore, just because a backtest of your trading bot has made +300% in the last 6 months, does not mean that your trading robot will make +300% in the next 6 months. In fact, you simply have to remember that past results are no guarantee of future results.

Moreover, backtests never completely correspond to what would have happened in reality, because they depend on factors that cannot be taken into account such as the order execution time or the spread (the price difference between the buy and sell price). All software that performs backtesting is therefore obliged to make shortcuts and simplifications. The backtest shows how everything works in theory.

These various limitations do not prevent backtests from being very useful to get an overview of the functioning and potential of a strategy.

How to make backtests?

A backtest simply consists in analyzing each candle of a given period with its strategy. Nothing prevents you from analyzing the charts by hand on TradingView to replicate how your strategy works. But most trading bots, whether ready for use, customizable or installable, allow you to do backtests almost instantaneously. This saves you a lot of time.

Obviously, if you want to backtest your own strategies, you would have to go through platforms that allow you to design strategies, such as our Botcrypto platform where no technical knowledge is required, or Freqtrade where we have written an installation and configuration tutorial.

Our tips for setting up the best backtests

Finally, here are some tips to configure the best backtests :

  • Reproduce the backtests with the conditions closest to your trading conditions to get the most relevant results. If you can set the initial backtest funds, set a realistic amount. If you can configure the fee taken by the platform, configure that as well.
  • Perform multiple backtests in different market conditions. If you’re looking to build a strategy that takes advantage of Bitcoin’s volatility, don’t settle for just one backtest. Instead, try to run several backtests, on different trends, over different periods of time, to get the most representative results possible.
  • When building a strategy, change only one parameter at a time between each backtest. This will make it easier to understand the results of the backtests.
  • And if you are satisfied with the result of your strategy, then save it, with a copy for example. This will prevent you from losing your progress in the search process.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.