Backtesting Trading Strategies
What is Backtesting?
Backtesting is determining how a trading strategy would have performed in the past. Backtesting is an essential element of developing an effective trading system. It can be done manually or systemically, and it aims to establish whether a trading strategy is worth implementing in the live market.
The underlying principle is that a strategy that worked successfully in the past can be trusted to deliver profitability in the future. Of course, this assumes that price patterns in the markets tend to repeat themselves. However, this may always not be the case because markets are always dynamic and ever-changing.
Open an Account at AvaTrade and implement your winning strategies today!
Nonetheless, backtesting remains a sound risk management activity, and it helps traders avoid implementing subpar trading strategies in the live market without ascertaining their potential effectiveness.
Good strategies after backtesting give traders the confidence to apply them in the markets, while a flopping strategy can be tweaked or abandoned altogether.
Backtesting a portfolio is a method of establishing how a specified portfolio asset allocation would have returned in the past over a certain period. A portfolio can consist of one asset class or span several asset classes.
For instance, an exclusive stock portfolio can consist of stocks from several industries such as Financials, Technology, and Industrials. Alternatively, a broad portfolio may consist of several asset classes such as Stocks, Bonds, REITs, and Commodities.
Portfolio backtesting is done to identify the optimal composition that can help investors achieve their desired objectives. The objective can be managing risk or achieving greater value.
Portfolio backtesting utilises broad data sets and can include fundamental and economic events that occurred in the past, such as earnings reports, divestitures, mergers & acquisitions, regulatory changes, and interest rates.
When portfolio backtesting is done, investors need to interpret its yield information. Some of the variables to analyse include Compound Annual Growth Rate, Standard Deviation, Maximum Drawdown, and Sharpe Ratio.
Portfolio backtesting should qualify a portfolio allocation strategy or help an investor identify the best weightings for each asset required to achieve their desired results.
How to Backtest a Trading Strategy?
A backtest utilises historical data to qualify a strategy. The underlying trading style will determine how a trader will go back. A long-term investor may have to consider many years back, whereas a short-term trader can use data of several weeks or a couple of months. Backtesting can be done manually or systematically, and it will generally follow the steps below:
Define the strategy
Outline all the parameters that constitute your strategy. This includes the asset class you are trading and the chart timeframe. Different asset classes have different characteristics, and they will determine the amount of historical information to be collected. For instance, bonds can be analysed for as much as 20 years, whereas short-term currency traders can utilise data for up to a couple of weeks.
Look for trades
Look for trades that meet the conditions of your strategy. Analyse and record the entry, and exit signals that the strategy would have generated had all the trades been taken. All valid trades should be recorded to determine the gross return. Valid trades constitute both winning and losing trades.
Determine the net return
The net return is determined by factoring in other trading-related costs such as transaction costs, commissions, or relevant subscriptions. Compare the net return to the initial capital over the backtested period to find the net percentage return.
When done effectively, backtesting will help determine whether a trading strategy could be profitable or not. A profitable strategy could be deployed in the live market with confidence, whereas a losing strategy may have its parameters tweaked and backtested again, or it can be abandoned altogether.
Here are some tips to ensure effective backtesting:
- Consider different market scenarios. If you only backtest during bull markets, your strategy may perform poorly during bear or sideways markets.
- Aim to keep volatility as low as possible. A highly volatile strategy could especially be devastating in leveraged markets and expose you to potential margin calls.
- Backtest using a relevant set of data. For instance, a trading strategy applied in manufacturing stocks may perform poorly when trading technology stocks.
- Customise backtesting parameters to meet your specific needs to get accurate results. The parameters can include position sizes, margin requirements, and transaction costs.
- Be careful about over-optimisation. The intention is to get a profitable strategy (more wins than losses sustainably) and not a perfect one.
You should also be aware that, though useful, backtesting may not be the best way to determine whether a strategy will be successful or not. This is because markets keep changing, and past results do not provide a cue for future performance.
Backtesting vs Forward Testing
Backtesting involves determining how a strategy would have performed in the past. However, historical data alone is not enough to establish the viability of a trading system. This is why it is important also to perform forward testing.
Also known as paper trading, forward testing simulates trading using live market data. It’s called “paper trading” because the trades are entered on ‘paper’ and do not use deposited capital, so no money is lost. Forward testing helps assess how a strategy would perform under live market conditions.
Limitations of Backtesting
Despite the importance of backtesting, the process has its limitations. One of the significant limitations is the danger of over-optimisation. This happens when an investor excessively tweaks a strategy’s parameters to derive as many profits as possible based on available historical data.
Ultimately, this could lead to a strategy that has been designed to make a profit over the backtesting period, but it could largely be ineffective under normal trading conditions.
Another limitation is the possibility of survivorship bias. It is possible to only apply backtesting to assets that survived a particular backtesting period with hindsight knowledge.
For instance, during the height of the COVID-19 pandemic, an investor may decide to use backtesting on a strategy designed to pick pharmaceutical stocks that thrived during that crisis period.
Backtesting also underestimates the impact of other important factors such as luck, randomness, trading psychology, and unpredictable transaction costs such as slippages. These factors can substantially tilt the upside or downside and provide ineffective results after backtesting.
Backtesting could be a significant phase of strategy development. If performed effectively using the tips outlined above, it may help create sound trading strategies and optimise promising ones that could be applied in the live markets with confidence. Nonetheless, it is crucial to perform backtesting with the full knowledge of its usefulness and probable limitations.
See a trading opportunity? Open an account now!
- What is backtesting?
Backtesting is determining whether a strategy is viable based on historical data. It aims to observe how the strategy would have performed in the markets in the past.
- Does Backtesting work?
Backtesting works as a method of establishing the viability of a trading strategy. Nevertheless, effective backtesting will also depend on the underlying strategy and awareness of the limitations of the process.
** Disclaimer –While due research has been undertaken to compile the above content, it remains an informational and educational piece only. None of the content provided constitutes any form of investment advice.