What is Backtesting a Trading Strategy?

How to Backtest Trading Strategy?

by Anupriya Gupta

Backtesting a trading strategy is a process of testing a trading hypothesis/strategy on prior time periods. Instead of applying a strategy for the time period forward (to judge performance), which could take years, a trader can simulate his or her trading strategy on relevant past data.

For example, say, a trader wants to test a strategy based on the notion that Internet IPOs outperform the overall market. If you were to test this strategy during the dotcom boom years in the late 90s, the strategy would outperform the market significantly. However, trying the same strategy after the bubble burst would result in dismal returns. The maxim ‘past performance does not necessarily guarantee future returns’ has to be kept into consideration while backtesting a trading strategy.

Keys Decision for Backtesting Trading Strategy

  1. Choose the market/ asset segment that one intends to trade
  2. Data to cover variety of market conditions
  3. Platform to code and backtest trading strategy
  4. Evaluate the system on benchmark parameters

Process of Backtesting

One can build a model using Excel VBA and test it later with R (if needed). Apart from this, testing on a simulator can give insight into the problems faced during execution of a strategy. Stimulator behaves like an exchange which can be configured for various market conditions. For simulator testing, the implementation of the testing system would require additional knowledge for C++/java.

Since some of the people are not from a technical background and do not have the requisite amount of coding experience, however, coding experience do assist in advising team in a better fashion.

Platforms Used for Backtesting

Apart from Excel VB, a quick backtesting of trading strategy for certain kind of strategies (for mainly technical trading) can be done using special platforms such as Amibroker, Tradestation and Ninja Trader. Amibroker has a good range of technical indicators while the benefit of TradeStation is that its coding language is very similar to English. NinjaTrader uses the very widely used and exquisitely documented C# programming language and the DotNet Framework.

Typical Backtesting Parameters to Evaluate a Trading System

  1. Total P/L
  2. Average P/L
  3. Success Ratio
  4. Maximum Drawdown
  5. Sharpe Ratio

Next Step

After understanding the basics of backtesting a trading strategy you can practice it using Excel. Here’s a more technical article on Backtesting Long Short Moving Average Crossover Strategy using an excel spreadsheet.