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

Backtesting in trading

Published on: 08/03/2022 | Modified on: 19/09/2023

Backtesting is a manual or systematic method of determining whether a trading strategy or concept has been profitable in the past. A trader can manually backtest a strategy or use backtesting software to help determine if a trading strategy is likely a waste of time and money, or if it shows promise and profitability in a variety of markets.

Since backtesting does not always require software and can be carried out by any type of trader, manual backtesting will be the focus of this article. This means that there is less risk without automated software as it can be tested using a free demo trading account, such as the one offered on our online trading platform. As always, there are no guarantees and as such, you should still consider risk management tools.

KEY POINTS

  • Backtesting uses historical data to assess which strategies worked and which didn’t
  • It is the opposite of paper trading or forward testing, which requires you to make real-time actions
  • Depending on if you’re using a short or long-term strategy, you could require data anywhere from several weeks to several years
  • Technical indicators such as RSI can help to support theories with accurate readings
  • The calculation for percentage return should indicate how successful the strategy was

What is backtesting?

Backtesting is the process of assessing how well a trading strategy or analytical method could perform, based on historical data. It is a key component in developing an effective trading strategy. There are infinite possibilities for strategies, and any slight alteration will change the results. This is why backtesting is important, as it shows whether certain parameters will work better than others.

To backtest, a trading strategy is required. At minimum, a trading strategy helps to define entry and exit points for both winning and losing trades, plus a position size. In addition, a trading strategy will often provide context, such as defining if and when trades should be taken. For example, only when the price is above or below a moving average, or during the first hour of the day.

Backtesting can be a simple or complex process, and traders may use either automated or manual testing. The former requires automated software​​ that searches for trades that meet the strategy criteria, then adds up the winning and losing trades to show if the strategy was profitable over a specified amount of time. Manual backtesting refers to a process where traders analyse past trades based on their strategies, and then add up the results themselves.

How to backtest a trading strategy

There are several steps to manually backtest a trading strategy or model. Backtesting requires historical data, which shows past price movements of a particular asset from trading charts. To backtest, a trader will typically need several weeks of historical data for strategies where the trades are short-term in nature. Many years of historical data may be required if testing a long-term strategy.

Here are some basic steps that you could take when carrying out a manual backtest:

  1. Define the strategy parameters. Backtesting involves practise so it doesn't require you to deposit and risk live money in the process.
  2. Specify which financial market and chart timeframe​ the strategy will be tested on. For example, you need to decide whether you are planning to focus on a single share or currency pair, or a variety of markets, as well as how long you will collect the results for, whether these are recorded over a one-week, one-month, one-year or 10-year historical period. Each choice will provide different results and information.
  3. Begin looking for trades. You could go back in time and look for trades from a year, a month or a week in the past, depending on how far back you wish to look.
  4. Analyse price charts for entry and exit signals. This can be done until all trades on the chart up to the current time have been located and marked or written down.
  5. To find gross return, record all trades and tally them up. This should include both winning and losing trades.
  6. TTo find net return, deduct any commissions and trading costs related to the trades from the gross return. The net return is the profit or loss over the specified timeframe.
  7. Get a percentage return over the whole period. Compare the net return to the capital required to make the trades, or your exposure.


The percentage return should give an indication of how successful the strategy is. If the results of a trader’s backtesting strategy are undesirable, or if a trader wanted to check another strategy or variation, you can simply repeat the steps above. A trader may wish to calculate their average risk/reward ratio over all trades to see if the strategy is worth it.

Although backtesting may show how a trading strategy performed in the past, it cannot guarantee a strategy’s future performance. For this reason, backtesting could be a useful tool but it should not be exclusively relied on. Traders can also ‘forward test’ their strategies in live market conditions to see if they work in real time, without basing them purely on historical data. We will discuss this further on in the article.

Spread bet or trade CFDs on over 12,000 instruments

Is it possible to trade for a living?

It is possible to make money trading, but it comes with many risks and extra costs that must be taken into consideration. Consult our section on ‘what else do you need to know’ before opening a potentially risky trade. After all, not all positions will end in profit.

To see whether you could make money from spread betting or trading CFDs, you could try out our risk-free demo account, which allows you to practise first using £10,000 of virtual funds. Once you feel confident enough to enter the live markets using real funds, you can then switch to a live account.

FCA regulated

Protected up to £85,000**

FTSE 250 group

2023 No.1 Web-based Platform*

2022 No.1 Platform Technology*

2021 Best Spread Betting Provider*

Are there any backtest indicators?

Technical indicators​ work well for backtesting because they provide specific readings at a given time. For example, if a trade is taken when the relative strength index (RSI) moves above 25 after being below the figure on a daily close basis, and the trade is taken at the following open, this is a very specific signal and can easily be tested, assuming that the exit is equally precise.

Backtest indicators can include the levels or signals that will trigger an entry or exit for a trade. Typically, this is an objective time, like a close or open following the signal, which helps avoid any confusion as to when the trade should be taken. There are a number of technical indicators available on our trading platform that could be used to backtest a trading strategy or model. Popular indicators for backtesting include Donchian Channels, Ichimoku Cloud and Heikin Ashi.

Learn more about our award-winning web-based trading platform​*.

What is the best strategy?

As always, there is no definitive ‘best' technique when it comes to trading within the financial markets. The best backtest strategy will depend on your trading personality, overall goals and level of experience. Below are two methods that you could consider using as part of a backtesting template.

Intraday backtesting

A trader interested in how to day trade​​ can manually backtest intraday charts. The simplest backtest includes looking at one-minute or five-minute chart timeframes, for example, of the asset being traded. You could find prior trades based on that strategy and then add up the profits and losses, which would provide an idea of the profit produced that week.

Backtesting vs forward testing

Whereas backtesting requires finding trades based on historical data to evaluate its future performance, forward testing is the process of simulated trading, where you “paper trade​” a strategy in live conditions. This requires the trader to watch the market in real-time, taking the strategy entry and exit signals as they occur.

Backtesting lets a trader know whether a strategy has profit potential, while forward testing helps to confirm or refute this. Forward testing (also known as walk forward optimisation) is also slower because it needs to be performed in real time. Each day is traded as it comes, whereas with backtesting, a trader can arrange years’ worth of historical trades in a single day, if desired.

Backtesting and forward testing can be used together to give a more complete picture of how a strategy performs, both historically and in real time.

New to trading?

Spread betting account

  • Our most popular derivative product

  • Tax-free trading*

  • Available to users in the UK and Ireland

  • Short selling and hedging allowed

  • Zero commission or currency conversion fees

Start spread betting

CFD trading account

  • Subject to capital gains tax*

  • Available to customers globally

  • Short selling and hedging allowed

  • Commissions apply for shares

  • MT4 trading on forex, indices and commodities

Start CFD Trading

Can you apply it to the forex market?

Manually backtesting in forex works the same as in other financial markets. However, as the forex market is open 24-hours per day during the week, you need to be certain to only backtest during times of the day that you can actually trade. Backtesting a forex strategy over a month and using all hours over each day is unlikely to provide reliable information, unless automation is involved.

Before backtesting, consider the time of day you will be able to trade. Perhaps you can only enter trades within a three-hour window. When backtesting in forex, you only need to record entries and their resulting profits and losses that occur during the trading window.

Is backtesting worth the effort?

Backtesting can be a useful tool when you are hesitant to put a strategy into action straight away. However, there are still a couple of pitfalls to consider.

  • The first is the problem of ‘over optimisation’. This is when a trader keeps changing their strategy to find the largest profit based on the historical data, which can lead to hindsight bias. The viable strategy may be ruined because now it has become customised only for the exact conditions that were present during the backtesting period. In the future, if conditions are different, the strategy could perform poorly.

  • The second pitfall is the fact that the more complex a strategy becomes, the harder it is to accurately backtest. Similarly, while more backtesting is better than less, testing on more timeframes, markets, and over a longer period takes considerably more time. All this effort may be undertaken only to discover that a strategy does not work.

Considering the above points, backtesting is still an important part of developing a profitable and successful trading strategy, without the risks involved. Backtesting with a demo account works in a different way to trading with real money, where emotions can be high and you may miss trades or enter unsuccessful ones. Then, when you are confident that your trading strategy may bring success, our live account comes with many risk-management tools at hand.

Below is a table of example instruments that you can trade on using our backesting demo account, including shares and ETFs, indices, forex, commodities, and bonds.

Stock indices

InstrumentMin spreadPriceDayWeek
-----
-----
-----
-----
-----

Forex pairs

InstrumentMin spreadPriceDayWeek
-----
-----
-----
-----
-----

Commodities

InstrumentMin spreadPriceDayWeek
-----
-----
-----
-----
-----

Shares & ETFs

InstrumentMin spreadPriceDayWeek
-----
-----
-----
-----
-----

Bonds

InstrumentMin spreadPriceDayWeek
-----
-----
-----
-----
-----

Pricing is indicative. Past performance is not a reliable indicator of future results.

What else do you need to know before trading?

Trading on the financial markets can be a daunting process, especially for a beginner, so it may be a good idea to brush up your knowledge on the following things beforehand:

  • Costs​ (including spreads, margin rates, overnight fees, commissions)

  • The risk that your chosen market or instrument presents

  • How trading with leverage works​ (also known as trading on margin)

  • How to prevent margin calls and account close-outs

  • Risk-management tools​, indicators and market data that can help with every trade

What is automated backtesting?

Automated backtesting requires backtesting software, which may be available for free on some platforms, but it can come with a cost. Automated backtesting requires clear rules that a computer can understand. This may require some coding knowledge or software that allows you to input the strategy criteria.

Automated software is not required to assess the validity of a strategy using backtesting or forward testing. All that is needed is a demo or live trading account on our platform. After registering for our free backtesting software, you will have access to historical data on all chart timeframes, markets and assets, and a wide array of technical indicators to manually test nearly any trading strategy.

We also offer an inbuilt backtesting tool that relates to trading patterns. Our price projection tool is designed to help traders spot the direction of price action by measuring historical performance for each trading pattern. Learn more about this in our section on useful trading tools​​.

How to use the strategy with MT4

You can carry out both manual and automated backtesting using our MetaTrader 4 platform, using the required assets and timeframes. However, as creating an automated strategy in MT4 requires programming skills, many traders prefer to manually backtest their trading strategies, as this helps to build knowledge and skill within the financial markets.

Register for an MT4 demo account now.

Steps to getting started on our platform

So, have you finished reading this article and want to get started spread betting or trading CFDs on our platform? Follow the simple steps below to sign up for an account.

  1. Open a trading account to access our product library. You’ll be able to practise first using £10,000 of virtual funds on our risk-free demo account.
  2. With a demo, you can access financial markets such as commodities, forex, indices and treasuries for an unlimited period of time, as well as one-month free access to shares and ETFs.
  3. Deposit funds to open your live account and access unlimited instruments. Your subscription will also include exclusive market data, Morningstar reports and a Reuters news feed.
Find your flow: four principles for trading in the zone

Learn about the four trading principles of preparation, psychology, strategy, and intuition, and gain key trading insights from some of the world's top investors.

GET FREE EBOOK

FAQs

Does backtesting always work?

Backtesting isn’t an effective strategy 100% of the time, as market conditions are constantly changing. Fundamental factors that had an impact on a trade in the past may no longer be relevant, and new factors that you haven’t yet considered could come into effect, such as politics, interest rates, or global health crises.

Is backtesting the same as paper trading?

Whereas backtesting is used to see how a strategy performed on historical price data, paper trading is the more practical process of trading real-time market conditions with virtual money. Therefore, backtesting is often carried out using a paper trading account.

Can you backtest stocks?

With our demo trading account, users have one month to spread bet or trade CFDs with virtual funds on our share prices as part of your backtesting strategy. After this month, you can choose to switch to a live account to trade on the live markets.

*Awarded Best Mobile Trading Platform, ADVFN International Financial Awards 2024; No.1 Most Currency Pairs, ForexBrokers.com Awards 2024; No.1 Web Platform, ForexBrokers.com Awards 2023; Best Forex Broker, Good Money Guide Awards 2023; Best In-House Analysts, Professional Trader Awards 2023; CFD Provider of the Year, Investors' Chronicle/Financial Times Celebration of Investment Awards 2022; No.1 Platform Technology, ForexBrokers.com Awards 2022.

CMC Markets is an execution-only service provider. The material (whether or not it states any opinions) is for general information purposes only, and does not take into account your personal circumstances or objectives. Nothing in this material is (or should be considered to be) financial, investment or other advice on which reliance should be placed. No opinion given in the material constitutes a recommendation by CMC Markets or the author that any particular investment, security, transaction or investment strategy is suitable for any specific person. The material has not been prepared in accordance with legal requirements designed to promote the independence of investment research. Although we are not specifically prevented from dealing before providing this material, we do not seek to take advantage of the material prior to its dissemination.

Ready to find your flow?

start trading with a live account or
Try a demo with £10,000 of virtual funds.