Backtesting Strategies: Testing Trades with Past Data

Backtesting strategies use historical data to help determine the likelihood of a trade going as planned. Find out how to backtest on thinkorswim. archive: Backtesting for your trading strategies
5 min read
Photo by Getty Images

Key Takeaways

  • You can backtest just about anything—stocks, options, futures, and forex trading strategies
  • Backtesting may help you take better calculated risks, but know that past performance doesn’t guarantee future outcomes

It may sound strange, but three common phrases you often hear in the financial world are:

  • “If only I did this instead of that …”
  • “I should’ve, would’ve, or could’ve …”
  • “I saw that coming!”

These phrases remind us that we can’t predict the future. But that doesn’t mean we can’t harness the past to help us make more informed future investment decisions.

But how do you harness the past? With a special “time machine” called backtesting software. It might help you avoid making costly investment errors and even buy you some time (as ironic as it sounds).

Backtesting is the evaluation of a particular trading strategy using historical data. Results presented are hypothetical, they did not actually occur, and there is no guarantee that the same strategy implemented today would produce similar results.

What is backtesting?

Backtesting can help you evaluate investing strategies rather than investing on a hunch. For example, say you have an idea for a long-term investment you expect to hold for 10 years. You have a hunch your strategy might produce strong returns across the bull and bear markets yet to come. Well, in real time, you don’t have 10 years to test whether your “theory” is a fab doozy or a flunk-worthy deadbeat.

Nobody can afford to wait years to test a “thesis,” but you could use the past to test how your trading strategy might’ve played out. After all, that’s what backtesting is all about: to test an investment idea using historical data.

But there’s one big caveat—past performance doesn’t guarantee future outcomes. Another way to put it: What worked in the past may not work in the present or future in quite the same way, or at all. More on this later. What’s important to remember is that backtesting results are hypothetical. There’s no guarantee that the same strategy implemented today or in the future would produce similar results.

Benefits of backtesting strategies

The benefits of backtesting using historical data are pretty cut and dry:

  • You can test your investment ideas across as many months or years as you see fit.
  • You can test as many portfolio ideas as you wish.

Suppose you think that holding on to a handful of sectors via ETFs or mutual funds might be a good long-term investment strategy. If you backtest your idea, you can see how it might’ve performed over the last year, last two years, the last bull or bear market, or the last several decades. You can even run this test by mixing and matching portfolio combinations.

It might take you more time to run different combinations, but it could be fun, insightful, and speedier than real time. More important, it’s risk free because you’re backtesting in a virtual market environment and not putting real money on the line.

Ultimately, backtesting can help you make a more informed decision about your strategy idea so you don’t end up risking your investment capital on an untested hunch.

A backtesting strategy for almost every market

You’re probably asking yourself, “What can I backtest?” The short answer: almost anything.

Backtesting stocks is a common practice. You can even backtest futures and forex. Options backtesting might be helpful if you have the right software to do it. And if you’re an algorithmic trader, backtesting trading strategies might help if you have a goal of “strategy diversification” (similar to portfolio diversification, but on the scale of entire strategies rather than individual assets).

If you have the right software, you can eventually design several backtesting strategy “portfolios”—different tests for different markets, different asset classes, and different time periods. Think of it like having your own laboratory for designing personalized investment strategies.

Options backtesting on thinkorswim® example

If you want to give backtesting a try, fire up your thinkorswim platform and select OnDemand in the upper right of any tab. The OnDemand tool lets you replay all the data, tick by tick, for any day from December 7, 2009, up to the present (future days are prohibited by time). You can use this on charts, options data, futures, or forex. OnDemand gives you a practice account with $100,000 in “virtual” money so you can enter simulated trades based on the replayed prices and see the profit and loss change.

Here’s an example of how you could use OnDemand to backtest an options strategy. On the Trade tab, enter a symbol, then select OnDemand.

Go back to any date you want using the calendar. Perhaps you want to select a date prior to a price spike or an earnings call. Select a bid/ask to buy or sell an option or options spread and fast-forward to its expiration date to see how the trade might’ve performed (see figure 1).

FIGURE 1: ALMOST LIKE THE REAL THING. OnDemand can be set back to any date between December 7, 2009, to the present. You begin with the buying power of $100,000 in “virtual” money, which you can reset at any time. Watch options trades play out from when you placed the trade until expiration. Chart source: thinkorswim platform. For illustrative purposes only. Past performance does not guarantee future results.

You can also run OnDemand on the price chart of the underlying security to see how the stock price performed. When you’re done backtesting your options strategy, select OnDemand again to go back to your live trading account. OnDemand is available 24/7, so you can test your trading skills and strategies with replayed live data at any time.

Backtesting: The bridge between “paper” and “reality”

Backtesting trading strategies is emotionless. It assumes you’ll take action without fail when a signal is given. That’s good in theory, but when you get hit by a news event, an unexpected volatility shock, or when market sentiment sours, feelings of anxiety, fear, or greed may overtake what you “know.” So, stay disciplined. And if you suspect something’s wrong with your investment approach despite your backtesting, then resolve it calmly. But there may be times when market volatility jumps out of your paper (backtesting) statistics and throws you a curveball. Expect it to happen—because it will.

A time lapse, sort of

Backtesting can help you examine and evaluate investing strategies rather than investing on a hunch. But remember, you have to come up with your ideas first and then test them. And although Ben Franklin did wisely say that “Time is money,” studying what took place over time could be worth it.


Key Takeaways

  • You can backtest just about anything—stocks, options, futures, and forex trading strategies
  • Backtesting may help you take better calculated risks, but know that past performance doesn’t guarantee future outcomes

Do Not Sell or Share My Personal Information

Content intended for educational/informational purposes only. Not investment advice, or a recommendation of any security, strategy, or account type.

Be sure to understand all risks involved with each strategy, including commission costs, before attempting to place any trade. Clients must consider all relevant risk factors, including their own personal financial situations, before trading.

Diversification does not eliminate the risk of experiencing investment losses. adChoicesAdChoices

Market volatility, volume, and system availability may delay account access and trade executions.

Past performance of a security or strategy does not guarantee future results or success.

Options are not suitable for all investors as the special risks inherent to options trading may expose investors to potentially rapid and substantial losses. Options trading subject to TD Ameritrade review and approval. Please read Characteristics and Risks of Standardized Options before investing in options.

Supporting documentation for any claims, comparisons, statistics, or other technical data will be supplied upon request.

This is not an offer or solicitation in any jurisdiction where we are not authorized to do business or where such offer or solicitation would be contrary to the local laws and regulations of that jurisdiction, including, but not limited to persons residing in Australia, Canada, Hong Kong, Japan, Saudi Arabia, Singapore, UK, and the countries of the European Union.

TD Ameritrade, Inc., member FINRA/SIPC, a subsidiary of The Charles Schwab Corporation. © 2024 Charles Schwab & Co. Inc. All rights reserved.

Scroll to Top