A Guide to Backtesting a Trading Strategy

A Guide to Backtesting a Trading Strategy

by SigTech

Systematic trading (also known as algorithmic trading) is a feature of the quantification of finance expected to continue its transformation of investment management processes. Indeed, systematic trading strategies are an increasingly popular method of trading. They promise a rational, objective, rules-based approach to investment, which is consistent, cost-effective, and customizable. This ensures a level of discipline within the investment process, limiting the effects of drift and slippage by adhering to a set of predetermined rules and signals. The systematic approach to trading is part of a trend of quantification in finance, which along with the emergence of new advanced analytical methods like artificial intelligence and machine learning allows for the modelling of complex strategies based on financial and alternative datasets. Furthermore, they control for subjective opinion, emotion, and irrationality; features of the investment landscape which become more pronounced during periods of market uncertainty. An emerging body of evidence demonstrates that systematic trading processes outperform their discretionary counterparts1.


Backtesting a trading strategy

One of the features of systematic trading is the backtest. Backtesting reveals how a strategy performed over a specified date range and under distinct market conditions. Conceptualising a trading strategy as a set of rules and signals, backtesting identifies the historical profitability of those rules and signals. This process in turn facilitates the refinement and optimisation of the strategy. Ultimately, backtesting refers to the analysis of a trading strategy in relation to historical data in an effort to discern its performance characteristics ex-post.

Robust and comprehensive backtesting software is a necessary prerequisite for developing and evaluating systematic trading strategies. This software - often referred to as a backtesting engine - is a form of discrete event simulator which facilitates the modelling and analysis of trade ideas using historical price data over a specified time period. Furthermore, trading costs can be factored in to ensure an accurate representation of a strategy’s true potential profitability.

Promising backtesting results are no guarantee that a strategy will be profitable when executed in a live trading environment. However, simulated trading within a live production environment - often referred to as paper trading - allows for the further
analysis of a strategy prior to its execution.


The Trading Strategy Process

The conception, design, testing, and production of a trading strategy can be understood as a process of six sequential steps.

The process for backtesting a trading strategy
The process for backtesting a trading strategy

Step 1: Universe Creation

The first step in the systematic trading process is the formulation of a trading idea and the subsequent selection of an investment universe. An investment universe is a broad constellation of assets emerging from the initial trading idea. The greater the breadth of assets within this universe the better we are able to diversify the risk of any strategy emanating from it.

This initial step requires access to clean, validated, and operationally-ready datasets containing historical price series and other fundamental data for a broad range of financial instruments.

Step 2: Factor Selection

The second step is to select factors deemed good predictors of the future behaviour of an asset. Popular factors include, value, carry, momentum, and EPS growth. Alternatively, they can be based on technical analysis, such as moving averages. Factor investing is undergirded by the belief that assets exhibiting particular characteristics generate factor premiums which persist over time and across markets.

Step 3: Signal Generation

Using the factors that were selected in the previous step, a trading signal is created which works as an indicator of when to take specific market actions, e.g. buying and selling. They can be generated from a range of methodologies and are used to exploit market inefficiencies by identifying potentially profitable opportunities.

Step 4: Portfolio Construction

The next step is to convert the trading signal into a portfolio weight. Portfolio construction involves the selection of weights for each of the constituents that a strategy will trade. This identifies the quantity of an asset to buy and sell throughout the life of a strategy in order to maintain a specific weighting protocol. Portfolio techniques commonly used are market capitalisation, mean-variance, equal-weighted, and equal-contribution-to-risk. The choice of any one construction methodology should be informed by an investor’s objectives, their risk appetite, and the overall robustness and performance of the chosen technique.

Step 5: Backtesting a Trading Strategy

Once the strategy has been defined it can be backtested to assess its potential profitability and risk without taking on any actual market exposure. Backtesting trading strategies allows an investor to determine the performance of a particular strategy over a specified historical time period. This involves the use of extensive time series data and the application of a broad range of analytical techniques. Determining the historical performance of a strategy reveals a portfolio’s characteristics and possible future performance.

The results of a backtest can be displayed by generating a performance report including details about the individual trades executed and their respective profit and loss. Examples of additional analyses to assess a strategy are factor and return attribution analyses. More advanced packages will allow for a range of optimisations.

Step 6: Strategy Production

Once a trading strategy has been sufficiently refined by backtesting, it can be released into a live production environment. Production allows for the performance testing of the strategy using live market data. Like backtesting, this allows you to determine the profit and loss of specific trades as well as key metrics such as the strategy’s annualized returns. From the production environment, orders can be executed via an external order management system (OMS) or execution management system (EMS).


Backtesting with SigTech

Backtesting software is essential for performing the quantitative analytics necessary for systematic investment. It is an important feature of any comprehensive trading platform, alongside research, optimization, and production. SigTech offers a fully integrated quant technology platform; accelerating data-driven investment processes from dataset, through to backtesting and live trading. Our next-gen backtest engine facilitates the historical modelling of strategies trading across a range of financial instruments and markets, replicating the full trade life cycle of each instrument. It allows for the specification of direct and indirect transaction costs as well as the historical treatment of corporate actions at a granular level. A feedback loop between research and production maintains consistent results between backtesting and live trading.

SigTech is committed to the continuous development and improvement of backtesting software and the widening of the functionality available to the market in its pursuit of building, testing, and executing profitable short and long term systematic investment strategies. SigTech eliminates the expensive upfront costs of infrastructure build-out and provides everything you need to construct, backtest, optimise, and deploy your trading strategies. Leave the complex configuration to us and start chasing alpha today.

References

1. See Grobys et al. (2022): Man versus machine: on artificial intelligence and hedge funds performance