What is backtesting and how do you backtest a trading strategy?
With a wide range of markets to trade on our platforms, you’ll need a backtesting strategy that’s best suited for each asset class. Explore the benefits and risks of backtesting.
What is backtesting?
Backtesting is a way of analysing the potential performance of a trading strategy by applying it to sets of real-world, historical data. The results of the test will help you lead with one strategy over another to get the best outcome.
Backtesting relies on the idea that strategies which produced good results on past data will likely perform well in current and future market conditions. Therefore, by trying out trading plans on previous datasets that closely relate to current prices, regulations and market conditions, you can test how well they perform before making a trade.
It’s important to note that backtesting isn’t a guarantee that a strategy will be successful in the current market. Past results are never a fool-proof indicator of future performance. Rather, it’s part of doing your due diligence before opening a position. Backtesting will help you to establish how volatile an asset class can become and take the necessary steps to manage your risk.
Traders should bear in mind that real trades incur fees which may not be included in backtests. Therefore, you need to account for these trading costs when performing these simulations as they will affect your profit-loss (P/L) margins on a live account.
With us, you can backtest on platforms like MetaTrader 4 and ProRealTime to customise your entire trading experience to your liking.
Learn more about trading strategies
The benefits and risks of backtesting
Here are some of the advantages and drawbacks to backtesting trading strategies:
The benefits of backtesting
- You can test various, even very different trading strategies very quickly and without risking any capital
- The test, optimise, re-test cycle of backtesting enables continued fine-tuning of any strategy you think could produce favourable results
- Developing and adjusting strategies that are tailored to your individual preference in terms of risk versus reward
The risks of backtesting
- Past data isn’t necessarily a good predictor of future market behaviour, so no strategy can guarantee accuracy
- You may be tempted to refine a model so that it best fits historical data, without accounting for the fact that future conditions may be different
- Past datasets may be skewed due to an adverse market event or uncharacteristically positive sentiment
- Insufficient datasets will likely produce models that do not account for a wide variety of market conditions
- A trading strategy that works well on several datasets from one market (eg forex) may not work well in another market (eg shares)
- Strategies that tested well in a bullish market may not perform in a bearish environment, and vice versa
When implementing any trading strategy, it’s important to take the necessary steps to manage your risk. Even in a simulated environment where there’s only virtual funds to be profited and lost, it’s vital to get exposure to positions that suit your risk appetite.
Backtesting vs scenario analysis vs forward performance
Backtesting is different from scenario analysis and the forward performance approach to testing the effectiveness of a given trading strategy. For example, if there’s an impending lockdown in the UK in response to another Covid-19 outbreak, that will have an effect on market prices. It’s useful to check how certain sectors performed and which strategies produced good returns in the past.
By contrast, scenario analysis tests a strategy against a set of hypothetical market conditions, perhaps not found in historical datasets.
For example, you may run a simulation to track how a portfolio of stocks in the healthcare industry would perform using a certain strategy if the Covid-19 regulations lasted longer. A series of key variables would have to be factored in such as changes in interest rates and inflation.
Forward performance testing, also called ‘paper trading’, is the application of a trading strategy to current and unfolding market conditions without risking your capital.
Clients test their strategies on paper, not live within the trading platform, speculating on the exact points of entry and exit in certain conditions and documenting the results.
Perform these simulations using ProRealTime (PRT) for the best. This platform gives you the option to backtest a strategy, walk forward and use a market screener, so that you can filter stocks that fit your risk portfolio.
You can also trade risk-free on current markets by opening a demo account with us.
How to backtest on MetaTrader 4 (MT4)
MT4 has a backtesting tool called the ‘Strategy Tester’. You can test the automated trading programmes (called Expert Advisors or EAs) using the Strategy Tester tool.
Before you get started, make sure that the EA program is installed and dragged to the tester platform.
Once you navigate to the Strategy Tester webpage, you’ll launch the program to get several reports and charts supported by quantitative data for you to analyse.
There’s lots of information you can use to test your trading strategy, including profit-loss percentage ratio, the amount of profitable and loss-making trades in a given period, the risk factors involved and more.
The process of analysing the results helps you detect possible flaws in your trading strategy and enable you to customise the EA parameters to get the best outcome.
Here are 5 step to follow when backtesting on MT4:
- Select and load the Expert Advisor (EA) you want to test
- Open the Strategy Tester tool from the view tab in your MT4 terminal
- Input the parameters of your test and dataset date range
- Run your test and analyse the results
- Optimise by testing different input parameters (eg stop-loss values and limit orders)
Note that success with past data is no guarantee of future results. The market conditions and factors that influence the price could change over time, which can affect the accuracy of the simulation.
How to download MT4 through us
How to backtest on ProRealTime
The ProRealTime platform offers a powerful tool called ProBacktest.
To use ProBacktest, you’d navigate to the indicators and trading systems tab within the platform to launch the backtest. Select the backtest you want to run from the options provided. Once you click on ‘ProBacktest my system’, the program will run and give you a detailed report to analyse.
Traders can modify the parameters to test if the strategy is successful within a certain date range. You’ll observe the charts and detailed report of that strategy over the period tested. With this data, you can also customise the exact starting time of the strategy, the current time and the capital used in the test.
Some of the benefits of using this platform are that you can observe a breakdown of previous high and low points of the equity curve to instruct the level of risk you can tolerate. Additionally, there’s an orders list that features the price associated with each order and there’s a closed positions list that provide statistics of entry and exit date of each trade.
There are several ways to run a backtest with ProRealTime. Here’s an example of one of the methods:
- Navigate to the indicators and trading systems window
- Select the trading system you want to backtest
- Open the trading system and input your test parameters
- Run your test and analyse the results
- Optimise by testing different input parameters (eg stop-loss values and limit orders)
Remember, there’s no guarantee that re-testing and refining a trading strategy using past data will have a positive outcome when applied to current or future markets.
Backtesting trading strategies summed up
- Backtesting involves using historical data to analyse the potential performance of a trading strategy
- While there’s benefits to using past data to determine the best strategy in certain market conditions, there’s also the risk that historical results aren’t good predictors of future market behaviour
- Backtesting is part of a myriad of trading strategies that you can use, others include scenario analysis or forward performance to simulate market conditions before taking a position live
- You can simulate the trading strategies with us on MetaTrader 4 (MT4) or the ProRealTime platform
- Create a demo account to practise different trading strategies in a risk-free environment to observe which strategy performs the best
- Trading on a demo account is a form of paper trading using virtual funds, which enables you to speculate on real markets without the risk of losing capital
IGA, may distribute information/research produced by its respective foreign affiliates within the IG Group of companies pursuant to an arrangement under Regulation 32C of the Financial Advisers Regulations. Where the research is distributed in Singapore to a person who is not an Accredited Investor, Expert Investor or an Institutional Investor, IGA accepts legal responsibility for the contents of the report to such persons only to the extent required by law. Singapore recipients should contact IGA at 6390 5118 for matters arising from, or in connection with the information distributed.
The information/research herein is prepared by IG Asia Pte Ltd (IGA) and its foreign affiliated companies (collectively known as the IG Group) and is intended for general circulation only. It does not take into account the specific investment objectives, financial situation, or particular needs of any particular person. You should take into account your specific investment objectives, financial situation, and particular needs before making a commitment to trade, including seeking advice from an independent financial adviser regarding the suitability of the investment, under a separate engagement, as you deem fit.
Please see important Research Disclaimer.