What is 'Backtesting'

Backtesting assesses the viability of a trading strategy by discovering how it would play out with historical data.

Breaking Down 'Backtesting'

Backtesting allows a trader to simulate a trading strategy using historical data to generate results and analyze risk and profitability before risking any actual capital.

A well-conducted backtest that yields positive results assures traders that the strategy is fundamentally sound and is likely to yield profits when implemented in reality. A well-conducted backtest that yields suboptimal results will prompt traders to alter or reject the strategy.

Particularly complicated trading strategies, such as strategies implemented by automated trading systems, rely heavily on backtesting to prove their worth, as they are too arcane to evaluate otherwise.

The Ideal Backtesting Scenario

The ideal backtest chooses sample data from a relevant time period of a duration that reflects a variety of market conditions. In this way, one can better judge whether the results of the backtest represent a fluke or sound trading.

The historical data set must include a truly representative sample of stocks, including those of companies which eventually went bankrupt or were sold or liquidated. The alternative, including only data from historical stocks that are still around today, will produce artificially high returns in backtesting.

A backtest should consider all trading costs, however insignificant, as these can add up over the course of the backtesting period and drastically affect the appearance of a strategy’s profitability. Traders should ensure that their backtesting software accounts for these costs.

The Pitfalls of Backtesting

For backtesting to provide meaningful results, traders must develop their strategies and test them in good faith, avoiding bias as much as possible. That means the strategy should be developed without relying on the data used in backtesting. That’s harder than it seems. Traders generally build strategies based on historical data. They must be strict about testing with different data sets from those they train their models on. Otherwise, the backtest will produce glowing results that mean nothing.

Similarly, traders must also avoid data dredging, in which they test a wide range of hypothetical strategies against the same set of data with will also produce successes that fail in real-time markets, because there are many invalid strategies that would beat the market over a specific time period by chance.

One way to compensate for the tendency to data dredge or cherry pick is to use a strategy that succeeds in the relevant, or in-sample, time period and backtest it with data from a different, or out-of-sample, time period. If in-sample and out-of-sample backtests yield similar results, then they are likely generally valid.

  1. Automated Forex Trading

    Automated forex trading is a method of trading foreign currencies ...
  2. Currency Day Trading System

    A currency day trading system is a set of guidelines that a foreign ...
  3. Quantitative Trading

    Quantitative trading consists of trading strategies which rely ...
  4. Forex Trading Robot

    A forex trading robot is an automated software program that helps ...
  5. Rocket Scientist

    Rocket scientist is a term used by traditional traders for a ...
  6. Historical Returns

    Historical returns include the tabulation and analysis of past ...
Related Articles
  1. Trading

    The Importance of Backtesting Trading Strategies

    Backtesting is an important aspect of developing a trading system. If done properly, it can help traders optimize and improve their strategies.
  2. Trading

    Top 10 Rules For Successful Trading

    Whether you're a novice or an expert, these 10 rules should be the backbone of your trading career.
  3. Trading

    Automated Trading Systems: The Pros and Cons

    Automated trading systems minimize emotions, allow for faster order entry, lead to greater consistency and resolve "pilot error."
  4. Trading

    Trade Forex With A Directional Strategy

    Opening long or short positions to cash in on a trend is one of the simplest ways to trade forex.
  1. What is backtesting in Value at Risk (VaR)?

    The value at risk is a statistical risk management technique that monitors and quantifies the risk level associated with ... Read Answer >>
  2. How do you use put options to profit from a bear market?

    Learn how traders use put options in their trading strategies to remain profitable, even in a bear market. Everyday investors ... Read Answer >>
  3. What percentage of the population do you need in a representative sample?

    Learn about representative samples and how they are used in conjunction with other strategies to create useful data with ... Read Answer >>
  4. Is there a buy-and-hold strategy in forex?

    Most of the Forex traders tend to be short term traders, constantly timing the market swings in the hope of profiting from ... Read Answer >>
Trading Center