How to Backtest Stocks

Backtesting is a trading strategy optimization tool. It works under two assumptions; the first being that if a trading strategy worked in the past it will work in the future and the second, if a trading strategy did not work in the past it will also not work in the future. In practice, backtesting helps you uncover technical or theoretical shortcomings in your stock trading strategy, gives you an opportunity to correct them, backtest again and in doing so, optimize a current trading strategy or one you may be considering.

Choose Software

Backtesting is a specialized process not generally available individually or for free. So, start by researching and purchasing a standalone stock software program. Fortunately, backtesting is available as a standard feature in most every program, so after checking its system capabilities to ensure it includes backtesting, simply choose one that suits your needs. As an alternative, sign up with an online trading site that offers backtesting as part of its trading tool options.


Familiarize yourself with the user interface, paying close attention to areas or screens in which you enter stock symbols for your trades, select available customization options and view results. While specific steps may differ depending on the software or service you use, the overall process is similar. Start by entering one stock symbol if you want to backtest only stock trade and multiple symbols if you want to backtest your entire portfolio. Choose a time interval for testing, such as minutes or days and a time frame, usually measured in years. Next, set entry and exit signals that signal when the backtest should start and end and are in line with a current or potential trading strategy. Look at and configure other available options, such as setting conditions that indicate the backtest reveals a successful strategy and indicate a stop loss point if it is not.

View Results

Run the backtest, view your results and see whether your trading strategy was a success. Among those results generally available are a listing of the stock trades you selected for backtesting and time frames, if any, for prior backtesting on these stocks. Statistical results normally include win-to-loss ratios, net percentage gain or loss, average gain and loss, annualized return and risk-adjusted return. In addition, most also include exposure and volatility measurements.

Interpret Information

Compare your results to the general rules of trading. This will tell you whether -- and how many -- adjustments you need to make to optimize your trading strategy. In general, seek to keep volatility averages low, average gains and win-to-loss ratios high and pay close attention to annualized return percentages. Annualized return is a benchmark value you can use to compare against other trading strategies. As a final step before you put a seemingly successful trading strategy into play, make sure its risk-adjusted return is equal to or less than a strategy you may currently be using.

Photo Credits

  • Duncan Smith/Photodisc/Getty Images

About the Author

Based in Green Bay, Wisc., Jackie Lohrey has been writing professionally since 2009. In addition to writing web content and training manuals for small business clients and nonprofit organizations, including ERA Realtors and the Bay Area Humane Society, Lohrey also works as a finance data analyst for a global business outsourcing company.

Zacks Investment Research

is an A+ Rated BBB

Accredited Business.