Updated: Aug 21
Most people I admired a decade ago have quit trading.
Less than 5% of my trading inspirations are still in the market. This is a terrible fact.
Trading is an emotional game. If a trader cannot control his emotions, then he tends to commit mistakes.
Then, how to control emotions?
There are many ways – but the #1 method is to develop high conviction on your trading setup.
And Backtesting is the only way to increase your conviction on the trading setup.
What is Backtesting?
Backtesting is a process of analyzing the performance of a trading strategy with historical data. Traders use the results to compare, fine-tune trading strategies to get the maximum benefits in live trading.
In backtesting, three parameters are essential to evaluate the performance of a trading strategy:
Success Rate – It is the ratio between the winners and losers. For example, out of 10 trades, if 8 trades are successful and 2 are failed trades. Then the success ratio is 80%. There is an 80% chance that the trade based on this strategy will become a winning trade in simple words.
Risk-Reward Ratio – 'Success Rate' alone is insufficient to measure a trading system's efficiency because a trading system can lose money even after having an 80% success rate if the failed trades lose more money than money made in the winning trades.
In simple words, the risk-reward ratio is the average of the money in losing trades compared to the average of the money made in winning trades.
Suppose the average of the money in losing trades is 1000 and the average of the money in winning trades is 2000, then the risk-reward Ratio is 1:2.
Maximum Drawdown – Again, 'Success Rate' and 'Risk-Reward Ratio' will not measure a trading system's performance. Because trading is filled with emotions, and whenever a trader loses money, he gets a lot of emotions in his mind, and at some point, he will lose trust and confidence in the trading system.
Hence maximum drawdown plays a crucial role from a trading psychology perspective.
Maximum Drawdown is nothing but a maximum loss from a peak to the bottom level of a portfolio before it establishes another new peak.
Suppose a trader starts with 1,00,000 trading capital. He uses a trading strategy of his own. At one point, his balance went down to 80,000 before going up to 1,50,000.
In this case, the Maximum Drawdown is 20%.
A beginner can read Top-10 Trading and Investing Books if he is not aware of any good trading strategies.
How Backtesting Works?
Traders use backtesting to test and compare various trading techniques before taking trades in the live market.
The logic is straightforward. If a trading technique shows better results with the historical data, then there is a high probability of performing better in the future (vice-versa is also true).
If a trading system shows poor results, then the trader has two choices – 1) Discard it entirely and look for another trading system, or 2) Fine-tune the same system until it shows the better results.
A good trading system will show positive expectancy. For example, if a system displays a 50% success rate, 1:2 Risk-Reward, and 20% Maximum Drawdown, it is a better system as it showed positive expectancy.
Please note, the market will never move in the same passion. However, there is a higher probability that a trading technique behaves in the same way in the long run. Besides, backtesting a trading system and taking trades in the live market is far better than taking trades without logic.
Types of Backtesting
There are two types of backtesting:
In manual backtesting, a trader opens the charts and looks at the probable trade setups as per his trading system with the past data. Then he will mark all the essential parameters like entry, exit, stop-loss, risk, reward in an excel sheet. In the end, he will arrive at the overall success rate, risk-reward by averaging the details collected in manual backtesting.
In automated backtesting, traders will use some software or tool (Python, Amibroker) to perform the work. The advantage of this mode is we can get the results in a few seconds. But one has to learn the coding to define their strategy to the software/tool.
Typical Parameters to Evaluate in Backtesting
One has to record many parameters to assess the performance of a trading system. Below are essential parameters:
Note – For positional system use 'Entry Date' and 'Exit Date,' and for intraday system use 'Entry Time' and 'Exit Time.'
One can use the above template to log all the details when performing backtesting. In the end, traders can arrive at the 'Success Rate' and 'Risk-Reward' by averaging the Result and risk-reward tabs in the above template.
The above template can also be used as a trading journal to log all the trades.
You can download the template here.
Useful Tools for Backtesting
There are 1000s of backtesting tools and software in the market. But only a few of them have high quality and easy to use. Below are some of such useful backtesting tools.
It is the most popular charting tool among traders. It has not looked back after acquiring over a million active monthly users without any advertising budget in a month in 2016.
Tradingview provides a simple yet effective way to backtest a trading strategy.
It provides two types of backtesting:
Manual Method via Bar Reply
Automated Method via Pine Editor and Strategy Tester
'Bar Reply' is a simple feature that allows a trader to move backward and verify the price movements candle by candle to test the efficiency of a trading strategy.
'Automated method' is the most effective way to backtest any strategy in a few minutes. However, it demands little coding efforts in 'Pine Editor' and verifies the results on the 'Strategy Tester' tab.
Read the article on Tradingview to know more about backtesting using Tradingview.
It is a full-fledged professional software that helps traders to view the charts, analyze the market conditions, backtest different trading strategies, and run algo-trading.
Again this tool provides both manual backtesting and automated backtesting.
Using the 'Bar Reply' option, one can turn past candles to run as live bars provided the historical data is uploaded in the software. In this way, traders can achieve manual backtesting on any scrip.
Amibroker Formula Language (AFL) is a method to define your trading strategy to perform automated backtesting.
To know more about Amibroker, watch the below video.
As per Python.org definition, Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built-in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development and use as a scripting or glue language to connect existing components.
There are many ways to backtest a trading strategy using Python. Traders can run backtests with pre-existing libraries, or they can build their own backtester, or they can use any cloud platform.
There are two popular Python libraries for backtesting – 1) Backtrader and 2) Zipline
Refer this article to know more about Backtrader.
Refer this article to know more about Zipline.
It is software designed by traders for traders. It is one of the oldest charting and backtesting tools. It has many inbuilt tools and systems which can be used to find pre-determined patterns in trading. Besides, traders can also create a custom trading system and test the results.
It supports both the scanning and backtesting option. 'The Explorer' is the scanning tool present in the Metastock. Similarly, 'The System Tester' is the tool for backtesting different strategies in Metastock.
Streak is a cloud-based backtesting and algo-trading platform in India. Any Zerodha or Upstox user can log in to Streak and perform backtesting.
It supports both scanner and strategy builder options. Besides, it also comes with many user-defined trading strategies.
The beauty of this cloud-based app is there is no need to write any code to backtest a strategy. It provides an interactive interface through which any trader can build and test their trading strategies. Besides, there is no need to buy the historical data as Streak has the inbuilt historical data.
One can read this article to know more about Streak.
Backtesting is the first step towards successful trading. It helps both discretionary traders and algo traders. However, irrespective of backtested results, traders can expect unexpected moves from the market. Hence, money management rules are crucial to avoid significant losses.
You will learn 3 tested intraday trading strategies in the below course.
Get the Mini Trading Guide
A 5-day email course with amazing tips on trading, different trading instruments, and how to finalize a trading system. Get a best-selling eBook and online course by signing up for free.