Learning how to backtest your trading strategies is essential if you want to become a successful trader.
It’s shocking the number of traders I have trained over the years that have never done any backtesting. I’m usually backtesting at least on a weekly basis, especially when the markets are slower, and for good reason.
As a new or unprofitable trader, backtesting will not only help build your confidence but will help you better define your strategy.
What Is Backtesting
Backtesting is the process of analyzing historical trade data to see how a trading strategy would have performed statistically in the past.
There’s three primary ways to backtest a trading strategy.
Manual Backtesting: Manual backtesting simply involves going through your historical charts candle by candle. There’s some key advantages to manual backtesting over the others that we will discuss shortly.
Replay Backtesting: The majority of charting platforms offer replay where you can simulate a live market environment based on past trading data. Typically the replay software will compile stats on trades that you took.
Coded Backtesting: Algorithmic traders backtest their coded strategies by running simulations. Although I have written some basic code in the past and traded some successful algo’s that capitalized on some arbitrage opportunities, it’s not my main area of expertise. The remainder of this article is going to focus on the prior two forms of backtesting.
I personally prefer manual backtesting over replay backtesting. I’ve tried several different pieces of software over the years and typically they tend to lag and it’s much more time consuming than just manual testing. Replay can be beneficial to new traders for getting extra repetitions but I feel it’s inefficient for backtesting.
If you use a simple spreadsheet, like we will in an example shortly, you can run any sort of test on the data that you want. You’re not limited by the software.
Before we get into at an example, lets discuss the main benefits of backtesting.
Benefits of Backtesting Your Strategy
Failing to learn to backtest your strategies is one of the main reasons new trader’s fail.
To be successful in this business you need a well defined trading strategy and flawless execution. Backtesting helps with both.
Manually backtesting a strategy will help you understand the strengths, weaknesses and characteristics of the strategy allowing you to better define it.
Furthermore, once you’ve thoroughly backtest a strategy and proven the strategy has the potential to be profitable it’s going to help give you the confidence to follow your rules.
Finally, It will help you better understand drawdowns of the strategy. EVERY trader and trading system will have drawdowns. Learning to lose money is an important aspect of success.
You will begin to realize that a drawdown is just a part of the random distribution of trades. You will start looking at the performance over a series of trades rather than on an individual basis.
I can’t even begin to tell you how many emails I receive from failing traders saying they have spent so much money on strategies that they’ve traded and lost money on because the strategy sucked. Why would you ever trade a strategy prior to backtesting it?
Don’t be one of those traders.
Trading Backtesting Software
As mentioned earlier you can backtest a strategy using replay software, running a simulation on an algorithm, or by manually testing with your charting software.
Let’s look at some software companies than can help you with each style.
Replay Backtesting Software
TradingView – TradingView is a very popular web based charting platform that offers a replay option that they call rewind.
MotiveWave – MotiveWave is the platform I personally use and what all the images in the blog are generated from. They have a replay function that I know some of our members have used and been happy with.
Algorithmic Backtesting Software
TradeStation – TradeStation has always been a leader when it comes to automated trading. TradeStation’s proprietary programming language, EasyLanguage, allows you to design customized indicators and trading strategies using English-like statements.
MetaTrader 4 – MT4 is a popular among Forex traders. MT4 has a strategy tester for the expert advisor you code. MetaQuotes is based on the concepts of the popular С++ programming language
NinjaTrader – NT is very popular among futures algorithmic traders. NT8 is based on C# programming language.
I’d like to mention quick that the odds of you learning to program and creating a successful trading algorithm are close to zero. I realize that algo trading and the idea of making money while you sleep or without any input sounds sexy, but it’s just simply not the case.
Large firms will spend millions of dollars hiring the brightest quant researchers and programmers yet most of them still fail to ever develop a profitable strategy.
The ones that do, typically are relying on some sort of market manipulation which requires a lot of capital or found an arbitrage opportunity. Furthermore, the employ the fastest programs, data processing, and market connections to cut down on slippage which is the achilles heel for a lot of algo strategies.
I’m not saying it can’t be done, but if you’re new to trading it would not be where I would start as you most likely will just go in circles.
Manual Backtesting
Hands down my favorite free backtesting software is Google Sheets (or Excel).
Ever strategy is different in terms of instruments traded, entry methods, trade management, risk management making it very difficult to create a one size fits all piece of software for backtesting.
With Google Sheets, you can manipulate data to fit your analysis needs. Most backtesting software is not going to be open source, so what you get is what you get, not the case with a simple old spreadsheet.
Learning to build and analyze spreadsheets will also help you down the road with strategy development.
I feel the same way about trade journals to be honest. They all have their limitations. The only limitation to Excel or Google Sheets is your knowledge.
Something easily solved with a quick Google or Youtube search. If you want to be a successful day trader you need to be a self learner, and I highly advised you get comfortable with spreadsheets.
To get you started, I’m going to give you a backtesting template that will cover the majority of your backtesting needs.
Free Backtesting Software ( Spreadsheet Download)
To download and prepare our free backtesting spreadsheet follow these steps:
- Become a JT Insider (it’s free) and in the first email you will receive a link to the Insider Downloads folder.
- Open the spreadsheet and go to File>Make a Copy. If it’s greyed out it’s because you’re not logged in. If you don’t have a Google Drive account, create one quick, it’s free.
- Click on the Example – Sample Data tab and play around with the spreadsheet to get familiar with it.
How to Backtest (Example)
There’s a few steps you have to accomplish before you can start backtesting. You’re going to have to have a trading plan done and a playbook started. Your trading plan and playbook should define:
- Entry: Define the setup (trigger, pattern, signal, etc.) in detail.
- Context: Define what context must be present for you to trade the strategy..
- Trade Management: Define your stop loss and take profit strategy.
- Risk Management: Define what your risk is going to be on the trade?
Here’s what we’re going to use for our example.
Name: Trend Line Break
Entry: Enter on close of 1 minute candle that broke a trend line
Context: Trade strategy after failed retest of high of day or low of day.
Trade Management: Place stop behind prior candle of signal bar
Risk Management: 1% per trade
Go to the first date of your data set and start going scrolling through your chart one bar at a time. At the close of every bar determine if you have a potential setup or not, and why.
In the above example you can see price started to meet the conditions for our strategy.
Price attempted to retest the lows of the day but failed and began to rally. Overhead we have a nice trend line that’s formed which is what we will use for our entry if we get a candle that closes above it.
Continue to advance your charts one bar at a time until a signal occurs (candle closes above trend line).
As we advance forward you can see we would have had an entry at 4,149.25. According to our strategy, we remain in the position until a candle closes below the 9 SMA which would have resulted in closing the position at 4,154.25.
Now simply head over to your spreadsheet and input the trade.
Repeat this process until you have ample data to start analyzing the results.
Backtesting Tips
There’s a lot of common mistakes made when backtesting a strategy. Use the following tips to help you out.
Objectivity
The accuracy of your results will be determined by your objectivity when backtesting.
This is why I highly suggest you go through charts candle by candle when backtesting rather than simply zooming out and viewing a larger period to spot setups.
Your mind tends to play tricks on you. The winning setups will be easier to spot and typically you will pass on some of the losers flawing your data.
Data Set Size
When I initially begin testing a strategy I like to get a minimum of 50 trades covering a span of 20 days.
Obviously every strategy is different. Some may only generate one setup per day, and if this is the case with your strategy you simply will have to look at a larger data set.
After I have 50 trades I begin analyizing the data to see if the strategy has potential. If it does, I don’t change anything with the strategy at this point, I collect more data. Typically I like to get around 200 trades.
After I reach 200 trades I begin optimizing the strategy by testing different trade and risk management techniques. Prior to taking a strategy live I will have somewhere round 300 – 500 backtested trades.
Volatility & Trends
Some strategies may look great to start because of the market environment you’re testing the strategy in.
Make sure to test your strategy during periods of high and low volatility as well as trending versus range bound markets.
Your strategy may perform better or worse under certain market conditions. The only way you’re going to find that out is by backtesting in different conditions.
You can analyze where you should pull data sets from by looking at a daily or weekly chart of the instrument your testing to find different periods of volatility and trending vs range bound.
Slippage and Commissions
Far too often traders forget to include slippage and commissions in their results. Commission and slippage can reduce profit margin by a significant margin.
The impact commissions and slippage have on your strategy will depend on the style of strategy you’re testing.
For example, if you’re backtesting a scalping strategy for the eMini S&P500 that has an average profit of 6 ticks, it’s going to be impacted more by slippage and commissions than a strategy with a 10 point take profit
Forward Testing
After you’ve backtested and refined your strategy it’s time to forward test. Forward testing is simply backtesting the strategy on a simulated account in a live market.
I recommend you SIM trade a new strategy for a minimum of 30 days before taking it live. When trading a new strategy it will take you time to learn to identify valid setups as they unfold in a live market.
Conclusion
Backtesting will dramatically help you to improve as a trader. You’re getting free repetitions at trading and screen time makes the dream time.
You’re going to find that the more you backtest, the more ideas you’re going to develop more strategies. This process is something that you will continue throughout your trading career.
If you have any questions on backtesting make sure to leave a comment below!
SHARE THIS:
Adam
20 Year Professional Trader
Founder of JumpstartTrading.com
FULL BIO >
What are the signs that a strategy has potential? a return above 1.5% on invested capital?
Hi Mayk, thanks for the comment. You can’t just look at the return alone, you have to look at what you risked to make that return. Personally I like to see a Profit Factor of 1.5 or greater.
Reasons why backtesting is important:
Helps to evaluate the viability of a trading strategy
Allows traders to make adjustments to their strategy
Helps traders to better understand how their strategy works
Helps traders to understand market conditions
Helps traders to manage risk
Reasons why it is better not to do backtesting:
Backtesting is not a guarantee of how a strategy will perform in the future
Backtesting can give a false sense of security
Backtesting can lead to overoptimization
Backtesting does not take into account transaction costs
Backtesting can be tedious and time-consuming
Thanks for the comment Watson but I’d always backtest your strategies.