Backtesting: Harnessing the Past to Test Your Trading Strategies

Backtesting with past data can help determine the likelihood of a trade playing out a certain way. OnDemand on thinkorswim can backtest stocks, options, futures, and forex trading strategies.

https://tickertapecdn.tdameritrade.com/assets/images/pages/md/File 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 can help transform untested investment ideas into a time-tested strategy

  • Backtesting may help you make 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 stand as follows:

  • “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’re awful at predicting the future. But it doesn’t mean we can’t harness the past to help us make more informed future investment decisions. After all, professional fund managers use this technique all the time, so why not you?

But how do you harness the past? With a special “time machine” called backtesting software. It might help prevent you from 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.

Capturing Time (to Test Your Investment Ideas)

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 have 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. 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.

Spending Time to Gain Time

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 might be a good long-term investment strategy. If you backtest your idea, you can see how it might have 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 gambling 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 andforex. 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 across different time periods—essentially,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 of the trading platform. 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 any date between December 7, 2009, to the present. You begin with buying power of $100,000 in “virtual” money, which can be reset to suit your convenience. Watch options trades play out from when you placed the trade until expiration. Chart source: The 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 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 garner a portfolio of “time-tested” investing strategies rather than investing on a hunch. But remember, you have to come up with your ideas first and then test them. Don’t use the software to feed you investing ideas. That could lead you to that dangerous curve of over-optimization. And although Ben Franklin did wisely say that “Time is money,” the cost for the time you can gain and harness when you backtest could be worth it.

Print

Key Takeaways

  • You can backtest just about anything—stocks, options, futures, and forex trading strategies
  • Backtesting can help transform untested investment ideas into a time-tested strategy

  • Backtesting may help you make better calculated risks, but know that past performance doesn’t guarantee future outcomes

Related Videos

Call Us
800-454-9272

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. TD Ameritrade is a trademark jointly owned by TD Ameritrade IP Company, Inc. and The Toronto-Dominion Bank. © 2021 Charles Schwab & Co. Inc. All rights reserved.

Scroll to Top