Developing a stock trading strategy is both exciting and scary. You’ll be confident in your own work and also worried that you missed something. Diving straight in with your hard-earned money is risky. Stock backtesting gives you a way to assess your strategy without risk.
What Is Stock Backtesting?
The term “backtesting” describes any process designed to evaluate how a strategy would have performed in the past. Stock backtesting uses historical data and technology to evaluate how a strategy would have performed if you had adopted it at some previous point.
The assumption is that strategies that were effective in the past will be effective in the future and vice versa.
Pros and Cons of Backtesting
Backtesting a trading strategy can tell you a lot about how it has performed in the past and may perform in the future. While we can be fairly certain the future will be different, knowing a strategy’s strengths and weaknesses can be invaluable. If a strategy didn’t perform well in the past, it’s unlikely to perform well in the future. However, it’s worth keeping the benefits and drawbacks of backtesting in mind.
✔️ Pros of Backtesting:
- Backtesting tools show you whether a strategy was profitable in the past.
- You will know what sort of drawdowns were experienced.
- Using backtesting tools is a very efficient (time-saving) way to test a strategy with hundreds or thousands of trades.
- You may be able to see what market conditions led to underperformance, and you may be able to apply filters to avoid trading when those conditions arise.
- You can optimize parameters to improve risk-adjusted performance.
- You can remove indicators or rules that don’t add value.
❌ Cons of Backtesting:
- In practice, real-world results are almost always worse than the results of backtests.
- There is a temptation to over-optimize a strategy so that it performs very well over a specific period of historical data. This is known as curve fitting or overfitting.
- A trading strategy will still need to be tested live to determine slippage and trading costs.
- You may become overconfident based on the results of an initial backtest. This often results in rushing to begin live trading without exhaustive testing on a stock market simulator.
- There is an inherent bias toward creating strategies using patterns that you know have worked in the past.
- In short time frames, like day trading, execution plays an enormous role in performance. Backtesting can still be a starting point for day traders, but paper trading is more important.
Effective backtesting has some basic requirements:
- The strategy must be based on very specific, measurable, consistent criteria. A strategy even partly based on subjective evaluations or gut feel cannot be effectively backtested.
- The sample time period must be representative. For example, if your backtesting time sample is from 2010-2020, your test is entirely in bull market conditions. Your results will be skewed and will not predict performance in less favorable markets.
Like all trading methods, backtesting has limitations. You can use it most effectively if you are aware of those limitations.
Choosing Backtesting Tools and Software
There is a wide variety of platforms available for backtesting. These are some of the considerations to look out for when choosing a platform to evaluate your strategy:
- Market coverage. Different platforms cover different markets. Typically a platform will include one or more of the following groups of stocks: US-listed, Canada, US OTC, European, and other international.
- Time period. If you are developing long-term or timeless strategies, you should be able to test them over longer periods of time. Some platforms have data going back decades, while others only have 5 to 10 years of historical data.
- Price action data, fundamental data, or both? You may be building trading strategies based on technical analysis/price action or you may be building investment strategies based on fundamental data. You may also be using a combination of both. This is an area where trading and backtesting tools vary a lot. Some only use price and volume data, while others have a focus on filters like growth and valuation metrics. You will need to find out exactly which data the platform includes, and which of these filters can be used in a backtest.
- How sophisticated can a strategy be? Following on from the previous point, there is also a considerable difference between different platforms when it comes to building a strategy. Some stock screeners allow you to evaluate the profitability of a set of filters, while others allow for full strategy creation. Backtesting a set of filters can be informative for long-term investors but has its limitations. To evaluate a proper trading strategy, you need full control of entry and exit criteria. Each platform differs with regards to how sophisticated a strategy can be, and it really depends on how simple or complex you want the system to be.
Choosing the right platform for your needs is an important first step toward an effective backtesting experience.
Best Backtesting Tools and Software
Some of the backtesting platforms we like include:
TrendSpider is one of the newer technical analysis platforms and offers some innovative tools that aren’t available elsewhere. The platform has also built a loyal community of users. The platform includes powerful backtesting capabilities along with its stock scanner.
When it comes to backtesting tools, TrendSpider offers two major advantages. Firstly, most of the platform’s unique tools, including automated pattern recognition, can be incorporated into the strategies you evaluate. And secondly, creating strategies is easy and intuitive and does not require you to write code – though you can do that as well.
TrendSpider is primarily focused on price action rather than fundamental analysis. However, it is still very popular amongst investors who focus on momentum and growth stocks. TrendSpider’s pricing ranges from $33 to $97 a month. The backtesting feature is included in the Elite plan with a $65 monthly fee.
Get 25% OFF any TrendSpider plan when you sign up using the link below 👇
TradingView is another popular technical analysis platform with a large community of traders and investors who share their ideas and strategies on the platform. The platform is cloud-based and includes all of the technical analysis features you would expect to find on a TA platform. One of the major advantages of TradingView is that most global stocks and other assets are covered.
TradingView’s backtesting is not the most advanced around, but it is easy to use. It also displays results in an easy-to-understand visual format. Creating strategies on TradingView requires coding in the native programming language, Pine Script. This may sound complicated, but it’s actually quite easy to copy and adapt strategies shared by other traders. TradingView pricing ranges from free to $59.95 a month. The backtesting tool is available on the free tier, so you can try it out for free.
3. Trade Ideas
Trade ideas is an advanced market intelligence platform that leans heavily on artificial intelligence. The platform includes numerous AI-powered algorithms that generate trade ideas and can be incorporated into a strategy. Trade Ideas also includes social data that is built into the algorithms.
The backtesting tools module is very intuitive and does not require coding knowledge. It also provides a very informative analysis of results and suggestions for optimizing a strategy. Trade Ideas has two subscription tiers of $118/month and $228/month. The backtesting tools module is included in the more expensive tier.
FinViz is primarily a stock scanner to filter stocks using a combination of descriptive, technical, and fundamental criteria. In total there are 70 criteria you can use to narrow the market down to a more manageable watchlist. FinViz is also packed with other useful tools to help you keep on top of the stock market.
The FinViz backtesting tools module is fairly basic and only includes price action indicators, rather than the fundamental and descriptive filters. However, it can be a useful tool to develop trading strategies for stocks you find using the screener. FinViz offers a good balance between being straightforward to use and still being very informative and useful. The backtesting module is included in FinViz Elite which is available for $39.50/month. You can learn more in our extensive FinViz review.
QuantConnect is one of a new breed of platforms for quantitative and algorithmic traders. It is cloud-based and open source with an emphasis on collaboration. This platform includes fundamental data as well as price and volume data. The platform can also be used to trade automatically.
Building strategies, backtesting, and trading with QuantConnect require you to write code in Python or C#. The learning curve is steep and requires commitment. However, if you want to develop and assess strategies based on both fundamental and price data, QuantConnect is the way to go. Pricing starts at $8 for individual users – however, some data feeds incur additional charges.
How to Get the Most Out of Backtesting Tools
Backtesting should always be done on separate data samples. This is known as in-sample and out-of-sample testing. Initial tests are done on the first sample, and then the strategy is evaluated on the next sample. For results to be valid, there should be consistency between the in-sample and out-of-sample results. When results are consistent and indicate an edge, the strategy is then evaluated with paper trading and finally with live trading.
As much as possible, choose your sample periods so that both the in-sample and out-of-sample data cover a variety of market conditions. Most backtests have an element of survivorship bias built into them because delisted and suspended stocks are not included in the test data. Wherever possible you should try to include these stocks when using backtesting tools.
A good trading strategy is as much about risk management as it is about profits. It’s important to learn about the various risk management metrics. Strategies that tend to be robust and endure over time are often quite volatile. By contrast, strategies that have low volatility often break down when traded live. You should be prepared to accept some volatility if you want a strategy that continues to be profitable.