Skip to content

Spread bets and CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 69% of retail investor accounts lose money when trading spread bets and CFDs with this provider. You should consider whether you understand how spread bets and CFDs work, and whether you can afford to take the high risk of losing your money.
Spread bets and CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 69% of retail investor accounts lose money when trading spread bets and CFDs with this provider. You should consider whether you understand how spread bets and CFDs work, and whether you can afford to take the high risk of losing your money.

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 approach that's best suited to each asset class. Explore the benefits and risks of backtesting.

strategy Source: Adode images

Written by

Charles Archer

Charles Archer

Financial Writer

Publication date

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 can help you favour one strategy over another in the search for the best outcome.

Backtesting relies on the idea that strategies which produced good results on past data may perform well in current and future market conditions. 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 committing to 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 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. You need to account for these trading costs when performing 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. Learn more about trading strategies.

The benefits and risks of backtesting

There are several advantages to backtesting trading strategies. You can test various, even very different, strategies very quickly and without risking any capital. The test, optimise, re-test cycle enables continued fine-tuning of any strategy you think could produce favourable results. And you can develop and adjust strategies tailored to your individual preference in terms of risk versus reward.

There are also real drawbacks to be aware of. 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 differ — a pitfall known as overfitting or curve-fitting. Past datasets may be skewed due to an adverse market event or uncharacteristically positive sentiment. Insufficient datasets will likely produce models that don't account for a wide variety of market conditions. A strategy that works well on data from one market, such as forex, may not work well in another, such as shares. And 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 are only virtual funds to be gained and lost, it's vital to get exposure to positions that suit your risk appetite.

Test strategies risk-free 

Backtest on MT4 and ProRealTime with us.

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.

Backtesting looks to the past: it checks how certain sectors performed and which strategies produced good returns using real historical data. By contrast, scenario analysis tests a strategy against a set of hypothetical market conditions, perhaps not found in historical datasets. For example, you might run a simulation to track how a portfolio of healthcare stocks would perform using a certain strategy under a specific set of assumptions, factoring in key variables 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. Traders test their strategies on paper, rather than live within the trading platform, speculating on the exact points of entry and exit in certain conditions and documenting the results.

You can perform these simulations using ProRealTime, which gives you the option to backtest a strategy, walk forward and use a market screener, so you can filter stocks that fit your risk profile. 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 automated trading programmes (called Expert Advisors, or EAs) using this tool. Before you get started, make sure the EA program is installed and dragged to the tester platform.

Once you navigate to the Strategy Tester, 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 strategy, including profit-loss percentage ratio, the number of profitable and loss-making trades in a given period, the risk factors involved and more. Analysing the results helps you detect possible flaws in your strategy and customise the EA parameters to get the best outcome.

Here are five steps to follow when backtesting on MT4:

  1. Select and load the Expert Advisor (EA) you want to test
  2. Open the Strategy Tester tool from the view tab in your MT4 terminal
  3. Input the parameters of your test and dataset date range
  4. Run your test and analyse the results
  5. Optimise by testing different input parameters (such as 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 price can change over time, which can affect the accuracy of the simulation. Learn more about automated trading with us.

How to backtest on ProRealTime

The ProRealTime platform offers a powerful tool called ProBacktest. To use it, 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 'ProBacktest my system', the program will run and give you a detailed report to analyse.

Traders can modify the parameters to test whether 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.

One benefit of this platform is that you can observe a breakdown of previous high and low points of the equity curve to gauge the level of risk you can tolerate. There's also an orders list featuring the price associated with each order, and a closed positions list providing statistics on the entry and exit date of each trade.

Here's an example of one method to run a backtest with ProRealTime:

  1. Navigate to the indicators and trading systems window
  2. Select the trading system you want to backtest
  3. Open the trading system and input your test parameters
  4. Run your test and analyse the results
  5. Optimise by testing different input parameters (such as 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 are 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 one of many approaches you can use, alongside others such as scenario analysis or forward performance, to simulate market conditions before taking a position live
  • You can simulate trading strategies with us on MetaTrader 4 (MT4) or the ProRealTime platform
  • Creating a demo account lets you practise different strategies in a risk-free environment to observe which performs best, a form of paper trading using virtual funds that enables you to speculate on real markets without the risk of losing capital

Ready to put your strategy to the test? Open a demo account to backtest and paper trade with £10,000 in virtual funds, or open a live account to trade across 15,000+ markets. For more, explore our guides on trading strategies and automated trading.

Important to know

This information has been prepared by IG, a trading name of IG Markets Limited. In addition to the disclaimer below, the material on this page does not contain a record of our trading prices, or an offer of, or solicitation for, a transaction in any financial instrument. IG accepts no responsibility for any use that may be made of these comments and for any consequences that result. No representation or warranty is given as to the accuracy or completeness of this information. Consequently any person acting on it does so entirely at their own risk. Any research provided does not have regard to the specific investment objectives, financial situation and needs of any specific person who may receive it. It has not been prepared in accordance with legal requirements designed to promote the independence of investment research and as such is considered to be a marketing communication. Although we are not specifically constrained from dealing ahead of our recommendations we do not seek to take advantage of them before they are provided to our clients. See full non-independent research disclaimer and quarterly summary.