Backtesting a trading strategy may boost traders' confidence in their own approach because they believe that future profits will offset any losses.

Ever heard of backtesting a trading strategy? Anyone who has been in touch with trading platforms for some time must have heard of it. In this article, we will briefly discuss what is backtesting, why it is important, and how to backtest your strategy properly.


What is Backtesting in Trading, and Why is it Important?

Backtesting is the process of using historical price data to test a trading strategy's performance. It is based on the assumption that if a trading strategy has produced positive results in the past, it will continue to do so in the future. Backtesting also boosts traders' confidence in their own approach because they believe that future profits will offset any losses and that the strategy will allow them to make more money.

How to Backtest a Trading Strategy Like a Pro

Retail traders often use untested strategies, which is why they frequently experience losses. On the other hand, trading coaches, hedge fund managers, and full-time traders typically only apply trading strategies that have been thoroughly backtested.

Market conditions change over time, and testing results may not be applicable until the end of time. However, this impending expiry is not a valid justification to avoid backtesting. There are at least three reasons why backtesting in trading is essential:

  1. Benchmark your strategy: Through backtesting, we can give value to the strategy we are using. The values here can be used to determine profitability and probability. Backtesting may also provide certain numbers related to the win rate, maximum drawdown, and overall likelihood that the aforementioned strategy will be successful.
  2. Free trading exercise: As the saying goes, practice makes perfect. And backtesting is an excellent means to boost your expertise in the market without actually spending any money.
  3. Boosting confidence: Most people are ready to gain big in the market, but most of them are not actually prepared to face the market. We are not psychologically set to accept losses and all the ups and downs that will certainly occur in the market. In this context, backtesting provides a belief that we can still gain profits after repeated losses.

For example, backtesting on strategy ABC generates 80 wins and 20 losses in 100 trades. Without this knowledge, you may be tempted to give up after 18 or 19 consecutive losses. But the result of initial backtesting allows you to believe that you will win after the 20th loss.


An Edge of Probability and Profitability

Prior to backtesting your trading strategies, you have to first establish a certain benchmark. It will allow you to compare the results of several backtests objectively.

This article will use the term "Edge" as our benchmark, similar to the one used by Richard Dennis' turtle traders. Edge was chosen because of its ability to represent the level of probability and profitability of a trading strategy.

The Edge is calculated with the following formula:

E = (PW x AW) - (PL x AL)

In the formula, PW is Percentage Win, AW is Average Win, PL is Percentage Loss, and AL is Average Loss.

For instance, a certain trading strategy was tested 100 times, with 50 profitable trades and 50 losing trades. Its average win was 20 pips, or two times higher than its average loss which was only 10 pips. How was the Edge?

E = (PW x AW) – ((PL x AL)
E = (50/100x20) – (50/100x10)
E = 10 – 5
E = 5 pips

As such, we can conclude that:

  1. The winning ratio was 50:50.
  2. Within 100 trades, the maximum number of losses was 50x. These losses may occur consecutively.
  3. Within 100 trades, the maximum number of wins was 50x. There may be several winning streaks.
  4. Our edge on each trade was 5 pips. It means that if we are to use the strategy to trade as much as 100x, then we can expect profits of around 500 pips (5x100 results).

In short, we seek a higher edge through backtesting. The greater the Edge, the more money the strategy may bring us.


Three Types of Backtesting in Trading

Next, we have to do some backtesting. There are three types of backtests that can be performed on your strategy: manual and automatic. The three methods have their own respective advantages and disadvantages.


Manual Backtesting

Manual backtesting is a process that involves the analysis of charts and historical data and manually applying them to your strategy without the help of automated systems. Manual backtesting can be done on Metatrader or any other trading platform. Simply apply the indicators you want to use on the chart. Select the time frame you want to use, then drag the chart to the left as far as possible. This way, you can test the strategy without looking at the results on the right side of the chart.

Very simple, uncomplicated, and straightforward results. You can do it anytime, even during market close. However, it takes a lot of time and you may need to do a forward test to increase its accuracy.


Automatic Backtesting

Automated backtesting follows a similar process to manual backtesting but with the advantage of utilizing computer code or specialized backtesting software. Instead of manually analyzing charts and historical data, automated backtesting involves writing code, often in programming languages, to execute the trading strategy on historical market data. This automated process allows for faster and more efficient testing of multiple strategies.

Automatic backtesting can only be done in trading platforms that facilitate robots, such as Metatrader and cTrader. You have to first program your strategy on an Expert Advisor or bots, then gain backtesting results by operating the program.

Automatic backtesting does not take a lot of time. In fact, most experienced traders use automatic backtesting. You will, however, need additional knowledge in software programming. You can also pay someone else to make the program in accordance with your strategy, but it may be costly.


Semi-automatic Backtesting

Semi-automatic Backtesting makes use of expert advisors to automatically execute trades in accordance with the established strategy. However, we will take note of the results manually. This type of backtesting allows us to backtest our strategy while gaining real-market experience.

Premium software such as ForexTester allows us to recreate our strategies into expert advisors or bots, then backtest them and generate the results automatically. Since it may be fairly pricey, you may also choose cheaper alternatives by making use of trading platforms that feature automated trading builders (such as Metatrader and cTrader) and MS Excel.

First, create your own expert advisor through your chosen trading platforms. Then, backtest it on the same platform and note the results in an Excel document. Here's an example of semi-automatic backtests:

backtest a trading strategyThe table shows that:

  1. The winning ratio was 60:40.
  2. Maximum losses were 4x in a row.
  3. Maximum wins were 6x in a row
  4. Our edge on each trade was 3.32 pips. It means we can gain 33.2 pips in 10 trades.

Quite profitable, isn't it? However, keep in mind that the more data compiled during backtesting, the more reliable the results. In this context, backtesting result based on 100x trades is more credible than 10x trades.