- Detailed instructions + strategy analysis tips -
Are you struggling with Metatrader’s strategy tester and are you not sure if you are back-testing strategy correctly? Do you want to learn how to analyse Expert advisor properly and what to focus on during back-test? In this article 747Developments prepared this article which will show you how to back-test properly.
1. Get good quality tick data!
First thing you need to do is to get good quality ticks data. If you don’t get tick data with good quality, then any back-test is completely useless and will tell you nothing about quality of the tested strategy.
Metatrader 5 users have the advantage that if they use good broker, the broker provides real tick data for particular symbols and there is usually no need to download data from external source. More importantly the good broker provides this tick data with real spread that was applied by your broker.
Metatrader 4 users must use tick data from external source. Metatrader 4 terminal can not provide you good quality data by default. You need to use some of the external software to download good quality data (For example: QuantDataManager, TickStory, Tick Data Suite, etc.) If you want to know how to get 99 % tick data quality for free you can find it in the article: Back-testing with 99 % modelling quality for FREE.
Important note is that usually with increasing period of bact-test, the data quality is decreased. So the data quality can be around 99 % to 100 % just for past few years.
2. Run the back-test in Strategy Tester
Let’s assume the you have good quality data already and move to strategy tester. To find the Strategy Testr open the Metatrader terminal, and go to “View -> Strategy Tester” or press “Ctrl + R”. The Strategy Tester window will appear in Metatrader terminal.
The principle of using strategy tester is the same for Metatrader 4 and Metatrader 5 but the Strategy tester environment have big differences between the versions. In this article we will focus on Metatrader 5, because it enables much more detailed and advanced analysis in comparison to Metatrader 4.
On the strategy tester “Overview” tab select “Single” – it means single run of strategy tester.
First you need to set up properly the Expert advisor you want to test as well as account data and some other main parameters:
- Select “Expert” advisor you want to bact-test
- Select trading instrument (“Symbol”)
- Select time-frame
- Select Date range for back-test
- Forward: (Feature available only in MT5) is good for Forward testing but for this article keep it “No”
- Select delays: This depends on your connection and VPS server. Good VPS servers can provide delays lower than 5 ms. If you are using your PC you will have usually delays around 100 ms (You can at least approximately estimate the delay if you look at the right bottom corner in the terminal, there is “ping” in milliseconds. If you use MQL VPS you will find it in VPS tab).
- The most important part – select “Every tick based on real ticks”. This will test the EA on all the available ticks. So the report will be the most precise and only this method can reliable validate the strategy.
- Select Account deposit and currency
- Select your broker’s leverage.
- Optimization keep “Disabled”
Most of Expert Advisors have some input parameters that can be adjusted. This can be set in “Inputs” tab in Strategy Tester. In the “Inputs” tab you usually need to adjust lot size (that should be the same as lot size you are going to use in real trading). Or the lot size specified by author of the EA.
IMPORTANT: Always use fixed lot size for analysis of the EA! Only back-test with fixed lot size can show you how well the EA performs. Never use Automatic lot size calculation. Automatic lot size is very dependent on the period you start the strategy tester from and can produce misleading results
If you changed the settings and you want to get back the default settings provided by Expert Advisor just right click somewhere to “Inputs” tab field and select “Defaults”.
At this point you are ready to run the strategy tester. You can go back to “Settings” tab and press “Start”.
Now the strategy tester will run the back-test. Depending on the tick data, tested period, and complexity of the EA and power of your PC this test will take some time to finish. During the process you can watch some of the progress information. At first you should focus on the “Journal” tab. In the “Journal” tab you can find all the detailed progress information, like ticks synchronization progress, warnings, errors, debug messages, etc.
Second tab to focus on during back-test is “Graph” tab. It will show you how is the EA profitable and stable – ideally the curve will have increasing trend all the time, which means the balance will be increasing and EA is profitable. You can also watch there equity draw-down and deposit load.
Let the Strategy tester finish the back-test and you are ready to analyse the strategy.
3. Strategy Tester results analysis
Assuming the back-test finished successfully you need to know what to look for and how to analyse the results. This section will show you some tips for detailed strategy analysis.
At first you will probably look at the “Graph” tab. Obviously if the strategy is good, the balance on the Graph must have increasing trend. But you can find much more on this graph. You can see how much of the deposit is loaded in percent for the trades, how big is the equity draw-down during the trade operations or how much you loose if there is a trade closed in loss. So the “Graph” tab should bring you the basic overview about tested strategy.
Detailed analysis is reported on the “Backtest” tab. First of all you need to check the modelling data quality. Ideally you will have 100 % tick data quality – “History Quality” cell. But in reality it might be lower. If you back-test data not too far to the past (let’s say data younger than 2 years) you will be able to get 100 % quality tick data if you have good broker. This, of course, applies only for Metatrader 5 (for Metatrader 4 you need data from external source as described in first step). If you have good quality data you will see the progress bar next to “History Quality” completely filled with LIME green color!
I won’t explain in detail what each parameter in the report represents. You can find explanation for example HERE for MT5 (or HERE for MT4). I will rather tell you instead some tips what to look for during your analysis.
First you should look at “Profit Factor“. Golden rule says that it should be above 2.0 for scalping EA. For trend trading EA it can be lower but it should never be below 1.0 (in such a case EA is not profitable).
Second thing is number of “Total Trades”. This is number of trades for the whole period which you’ve selected for back-test. With easy math you can get an idea how often the EA approximately trades. So for example if you selected 1.5 years back-test (approx. 550 days) and there were 252 trades, you can see that in average the EA will trade less than once every 2 days.
Important thing to analyse is draw-down. Here is the section why you MUST ALWAYS USE FIXED SIZE OF LOT for the whole back-test. NEVER use automatic lot size for detailed back-test analysis! Focus on “Equity Drawdown Maximal” (or “Equity Drawdown Relative”). This parameter will show you how big draw-down was on the account during worst trading operation. Why the fixed lot size is now important? This draw-down you can expect in any point of trading (can happen even with the first trade with the EA). If you select automatic lot size this maximal draw-down can happen after one year of back-test when you have already larger account and therefore draw-down will be misleading.
Another thing to look is the trade success rate. Look at “Profit Trades” and “Loss Trades” – how many percent of trades are profitable and right after that how big is “Average profit trade” vs “Average loss trade”. You can get overview how long it will approximately take to compensate the loss trade with win trades.
Metatrader 5 allows you to analyse some more detailed information with nice visualization. If you scroll down in “Backtest” tab you will see some graphs where you can analyse in what times the EA trades the most, which days and months. Also which hours (days) are the most profitable or which have the most losses.
Another good graph is trade holding time graph. Here you can analyse how fast the EA trades. For example in the picture below you can find that Average position holding time is 25 minutes, Minimal position holding time is 1 second and maximal position holding time is 19 hours. Minimal, maximal and average are misleading statistics so for this case there is also nice visualization where you can see that the most trades are held less than 1 hour (most frequent green dots on the left side), whereas that 19 hours holding time was just a single trade.
Final thing you can check in the report is the “Deals” report. To access it, right-click somewhere on the “Backtest” tab and select “Deals”.
You can see there trade opening date and time, trade closing date and time, type of trade, commission, swap, profit (loss) and you can also analyse how frequently are the trades opened. For example you can see that sometimes there are 2 trades a day and sometimes there is not a trade for 3 days.
4. Conclusion
Understanding strategy tester analysis is necessary to successfully back-test Expert Advisor. On the MQL market you have the ability to download the demo for free and run the back-tests to validate the strategy. One thing important to know is that when you download demo version from MQL market for running you own back-tests it doesn’t allow you (from some magical reason) back-test latest week of data. Other than that it is available for unlimited back-testing.
What you should keep in mind after reading this article is to always have good quality data. If you don’t have good quality tick data then back-test is completely useless.
Another very important rule is to ALWAYS BACK-TEST with FIXED lot size to prevent your analysis from misleading results!
Finally, remember that this is only back-test that is simulated on some past data. It doesn’t guarantee you the same performance in the future because nothing can predict the future (not even the expert advisor). Also keep in mind that Expert advisors are programmed in that way that always analyse price chart, tick-data, and all other market information but this market data may vary with different brokers. So there might be some inconsistencies between results from different brokers. This is why it is highly recommended to run the back-test with your own broker’s data (preferably tick-data provided by your broker for MT5 terminal) including leverage, commissions, etc.
Last thing to be reminded for Metatrader 4 users – Always use the tick-data from some external source with applied market information from your broker. MT4 platform can not provide you good quality data (and 90 % quality is NOT ENOUGH)!
Share this:
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on Telegram (Opens in new window)
- Click to share on WhatsApp (Opens in new window)
Thank you, I’ve been looking for details about this subject matter for ages and yours is the best I have discovered so far.
Comments are closed.