Choose your trading platfom

Backtesting in trading

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.

See inside our platform

Get tight spreads, no hidden fees and access to 12,000 instruments.

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 based on the strategy, market and chart timeframe specified. 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. To 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.

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 Next Generation online trading platform.

What is the best backtest strategy?

As always, there is no definitive ‘best strategy’ 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 day trading​​ 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.

Backtesting in forex

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.

Free backtesting software

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​​​.

Join a trading community committed to your success

Manual backtesting on 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. Learn more about MT4 or register for an MT4 account now.

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.

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.

Read more about our execution and order types​.

Powerful trading on the go

Seamlessly open and close trades, track your progress and set up alerts