What is Backtesting
Backtesting is a way to test a trading strategy using previous financial data. A backtest will help to identify whether a trading strategy the potential to make a profit or not. There are two types of backtesting in this article, one describes how to manually backtest, the other shows you how to automatically test a strategy over a large amount of data.
Why Run a Backtest
A backtest can give you an idea of what the outcome of a strategy might be, give you an idea of the strike rate (how many trades win vs lose) and then allow you to work out the potential for profit. A backtest is used to see whether a strategy would work or not based on previous data.
Manual backtesting, particularly in MT4, requires the use of the Crosshair tool, an idea or strategy to test and then measuring where each trade would get in and out of the market. Recording the results might be done by hand or in a spreadsheet to see what the result might be. This is a very time consuming process which can be very disappointing if you do not come across a winning strategy after a number of attempts.
A manual backtest can be useful to quickly scan over the charts visually to determine is something might work or not. Because there is no coding or set up process involved in manual backtesting, it can be a great way to make quick assessments on whether you might proceed to automated backtesting preperation.
Automated backtesting is a way to test a large amount of data quickly to get a broad range of results to work with and refine the strategy.
To run an automated test, you first need to create an algorithm that will run your strategy in the markets. To learn how to code the program, we have a course that takes you through in an easy way to help you develop the skills to fast track your trading. Once you have coded the program, you can then run tests easily using the strategy tester. You can run a test and get results of years worth of trading in minutes, at the click of a button.
Backtesting with MT4 - Strategy Tester
You can access the strategy tester in MetaTrader 4 (MT4) by pressing CTRL and R or going into the View section up the top and clicking on Strategy Tester. For a quick test, you can turn off visual mode and you can also speed or slow the visual mode testing. Once a test has run, you will see a section called Results, showing some useful data on how the strategy performed over the specified period.
Backtesting with MT5 - Strategy Tester
You can access the strategy tester in MetaTrader 5 (MT5) by pressing CTRL and R or going into the View section up the top and clicking on Strategy Tester. For a quick test, you can turn off visual mode and you can also speed or slow the visual mode testing. Once a test has run, you will see a section called Results, showing some useful data on how the strategy performed over the specified period.
Is Backtesting Accurate
Backtesting is only as accurate as the data being used and the settings of the algorithm and test. Some tests will be close to what a real account would return, whilst other tests can be completely unrealistic in real account terms. This can be due to spreads, liquidity, ability to place or exit orders in the time outlined and much more. The accuracy of a backtest should always be questioned and then live tested in a demo account. This will help to ascertain if the strategy is viable in real market conditions.