Backtesting a Trading Strategy the Right Way

If you have been trading, you have encountered the concept of backtesting in forex, backtesting stocks

or backtesting options among others.

It is a very important practice for any trader since it gives you an idea of whether to stick with your chosen trading strategy or choose something different.

If you are not familiar with what is backtesting, don’t worry since I have explained everything below.

What is Backtesting a Trading Strategy?

Well, for starters, this is a process of testing a theoretical trading strategy periodically.

Rather than applying a strategy to judge performance for the period ahead, you can instead simulate your trading strategy based on relevant data from the past.

By so doing, a trader assesses the viability of a trading strategy by finding out how it will perform when historical data is used.

Should backtesting work, both traders and analysts will have the confidence to employ it (the relevant strategy) in the future.

Basic Knowledge About Backtesting

As was previously mentioned, backtesting forex gives the trader an opportunity to simulate a trading strategy using historical data.

This generates results used to analyze risks and possible profits before injecting any actual capital.

When properly conducted, a backtest yields positive results that give the traders assurance and confidence that profits will be yielded when capital is deposited into an account.

On the other hand, when the backtest yields negative results, or results that are not at their optimum, traders will be prompted to change or reject the trading strategy altogether.

In most cases, complicated trading strategies often rely on backtesting to prove their worth. These include strategies implemented by automated trading systems.

You can easily do a tradingview backtesting as shown in the image below. Tradingview offers a backtesting software that is easy to use, and has a lot of relevant features.

tradingview backtesting

Types of Backtesting

Trading strategy backtesting can be put into two broad categories, these are:

  1. Manual backtesting
  2. Automatic backtesting
  1. Automatic Backtesting

Just as the name suggests, this is done with the aid of a computerized program. I.e. expert advisors that manage and open trades on your behalf when certain conditions are met.

In order to create an expert advisor, you will be required to know certain programming languages, particularly syntax and MQL4. As a result, a simpler and more reliable manual testing may end up being the better option.

  1. Manual Backtesting

Steps involved:

  1. Open the chart of the desired currency pair that you intend to backtest your strategy on. To avoid complications, analyzing a pair at a time is highly recommended. You may analyze other pairs later if need be. Remember to apply the necessary indicators and other relevant tools to the chart.
  2. Checking the chart candlestick by candlestick, look out for setups that are in line with the strategy being tested.
  3. Once you have found a trade setup based on your trading strategy, note down the details of the potential past trade. Important details such as the date, entry point, stop loss, take profit and any other detail deemed necessary should also be included.
  4. Go over the process again until you iterate at a possible trade setup then go back to the third step.

Once you have the results of potential trades tabulated in a spreadsheet, the win rate calculations of the trading strategy will be conducted easily.

Should your strategy perform dismally during backtesting, then you should consider changing one variable/aspect at a time based on the observations that you make until you get a profitable forex trading strategy.

Unlike automatic backtesting, manual backtesting requires time and discipline. But if done right, it will give you a good idea of the strategy’s success rate.

Another advantage of manual backtesting is that it will give you a good understanding of the market, allowing you to practice determining entry and exit levels.

The market has a tendency of changing hence a strategy that was once considered successful may not be that successful now, and because of this, every strategy is accompanied by sensible risk management.

Backtesting Versus Scenario Analysis

Whereas backtesting relies on actual historical data to test for fit or success, scenario analysis tends to rely on hypothetical data that simulates different possible outcomes. I.e. scenario analysis simulates specific changes in the values of the security’s portfolios or key factors such as a change in interest rates.

Scenario analysis is commonly used to approximate changes to a given portfolio’s value in response to an unfavorable event, and may also be used to examine theoretical worst-case scenarios.

What are the Key Decisions for Backtesting a Trading Strategy?

  • Choose the right market or asset segment

Basing your judgment on factors such as the risks you are willing to take, profits you hope to earn, period of time for which you will be investing and whether it is long or short term, you can make a decision as to which market or assets will best suit the kind of trading you are looking to conduct.

Options such as trading in cryptocurrencies might pose greater risks compared to other options but have higher returns.

This shows the importance of knowing and selecting the right market and asset class to trade in

  • Evaluate the system on benchmark parameters

The reason why we backtest is to understand how a trading strategy will work in the future by measuring its performance based on historical data, and based on certain parameters such as success ratio, sharpe ratio and dollar P/L; we simply gauge its performance.

  • Data to cover the changes in market conditions

Prices in any market are subject to change without any prior notice.

This is because market prices are vulnerable and depend on different factors such as major announcements in the market regarding monetary policies, the release of a company’s annual report and inflation rates, among others.

What you have to accept in your mind is that the market will always change and this is why you need to backtest the trading strategies on different market conditions in order to know how the strategy will perform in the given conditions.

  • Know asset classes that are supported by the platform chosen

Before selecting a backtesting platform, know which asset classes are supported by the platform.

You will also need to know about the sources of the market data feeds and figure out which programming and code were used.

There are platforms available that provide the functionality to perform backtesting on historical data.

Shortcomings Associated with A Backtest

  1. For it to provide meaningful results, traders have to develop and test their strategies without being biased. What this means is that the trading strategy has to be developed without relying on the data used in backtesting, which may be more difficult than it seems.
  2. Traders build strategies based on historical data and must be strict when it comes to testing with data sets different from what was used to train their models. If not, the backtest will produce results that seem good when in actual sense they are useless
  3. Traders must avoid dredging. This is testing a wide range of hypothetical strategies against the same data set which will produce successful results that fail in real markets because of the many invalid strategies that would beat the market over a period of time by chance.

Importance of A Backtest

It offers analysts, investors and traders, in general, a way to evaluate and optimize the trading strategies and analytical models before implementing them.

The key part of backtesting trading strategies is the assumption that past performance will predict how the performance in the future will be.

Another assumption is that a strategy that worked poorly in the past, will perform poorly in the future. This is something that I have ascertained while backtesting forex since it is my main market of operation.


Leave a Comment