What is BackTesting?
Backtesting is the use of history data to determine how a trading strategy would perform over a specified period of time. From the results of the backtest, a trader can analyse the profitability and risk, and determines if a trading strategy works.
One of the important reasons of using forex robots is that it enables you to do backtest over years of data within minutes.
Ways To Test A Strategy
Trading on a demo account will take alot more time as compared to backtesting. With backtesting, you would be able to test few years of data within minutes.
Similar to demo account, it takes longer time than backtesting and this time real money is involved. Although testing on live accounts is the most accurate way of determining if a trading strategy works, it should not be the first step.
Why should you backtest?
Backtesting is the fastest way to determine if a trading strategy works. It should be the very first step in testing a forex trading strategy. Since backtest is a less strict form of testing, if the forex robot fails to pass this initial test, it is very unlikely to perform well on forward tests. After getting successful results, then a trader should then consider using this trading strategy on demo or live accounts.
Ways To Backtest
Forex traders can manually look at past data as a form of backtesting to determine if a trading strategy is profitable. This might work for simple strategies, however, for more complex strategies that require alot of calculations, it will be difficult to manually backtest it over few years. Even for simple strategies, by backtesting over years of data, it will require alot of time and effort.
Using Forex Robots
A quicker way of backtesting a strategy is making use of Forex Robots. Forex Robots would be able to swiftly run through years history data, even for complex strategies. From the results, the forex trader can accurately determine whether the trading strategy is profitable.
How To Backtest Forex Robots On MT4 Using Strategy Tester:
The first step would be to save the forex robot into the MT4 Folder.
Part 1: Saving The Forex Robot To MT4 Folder
- Click on File>Open Data Folder.
- Then go into MQL4>Experts
- Save the Forex Robot/Forex Expert Advisor into the Experts Folder.
Part 2: Opening Strategy Tester for Backtesting
If you are able to see the Strategy Tester window in MetaTrader 4, you may skip this step.
Click on View > Strategy Tester and the Strategy Tester window would appear.
Part 3: Learning to use the Strategy Tester for Backtesting
The Strategy Tester is a very useful tool which can help you backtest as well as optimize your trading strategies.
Settings of the different components:
Forex Robot Selection:
Choose Expert Advisor and select Forex Robot/Forex Expert Advisor you have saved in the previous part.
Currency pair you want to test the Forex Robot on.
Select “Every Tick” to get the most accurate results.
Use Date Checkbox:
Check it and select the date range you want to test the forex robot on.
Visual Mode Checkbox:
Enable Visual Mode if you want to see how the Forex Robot is performing on a chart. The slider on the right is the speed of the backtest, the more to the right, the faster the backtesting. If Visual Mode disabled, you will only see the trades and results.
Period is the timeframe you like to use, for example M1 = 1 minute, M15 = 15 minute, H4 = 4 Hour.
Spread is fixed, but do note that for live trading spread might not be fixed, hence this is one of the factors that makes backtesting different for live trading. The value for spread depends on the broker. For 4 digit brokers, spread is the number of pips, for setting of 3 means a spread of 3 pips. For 5 digits broker, the setting of 3 is 0.3 pips, hence to set it to 3 pips, the setting has to be changed to 30 instead. To determine whether your broker is a 4 digit or 5 digit one, count the number of digits after the decimal of the price. If price shows 0.98235, it is a 5 digit broker. For japanese yen pairs, a 4 digit broker will show 2 digits, and a 5 digit broker will show 3 digits. Another way you can find out is to click on the Symbol properties button.
Do not check optimization if you are just doing a backtest of a particular strategy.
Symbol properties shows some information about the Symbol (Currency pair) you have selected.
Settings in Expert properties:
Set amount of money to start with. Positions are the type of trades you want to take, for example if you only want the Forex Robot to place buy trades, then only select “Long”. Most of the time, the Forex Robot is programmed to match your trading strategy so “Long & Short” works for most cases.
These are the variables you can change, change the values to match your requirements. Ignore the last 3 columns on the right as they are for optimization use. After you are done with the settings, click “OK.
Finally, click start at the bottom right corner to run the backtest!
After the backtest is complete, you will be able to see the results of your backtest in the strategy tester.
In Strategy Tester:
Trades that the forex robot has taken.
Overall picture of your account balance.
Display of almost everything that the forex robot does. It also shows any alerts and errors that has taken place.