Backtesting means testing a trading strategy or an expert advisor on historical data. MetaTrader 4 provides a very simple and fast way to do it automatically via the Strategy Tester. Make sure to test your strategy before running it on a demo or real account. Also, make sure to use quality historical data or your results will not be reliable.
- To fix this you can backtest your trading strategy on MT4 or MT5. Whilst the strategy tester in MT4 and MT5 is mainly set up to test indicator and EA strategies, there is a way you can manually backtest a trading strategy that will allow you to practice on far more trades in a far smaller space of time. How to Download and Install History Into MT4.
- Forex Tester is a popular strategy backtesting tool for MT4. The tool requires no coding and it even provides traders with some pre-formed strategies. With Forex Tester, you can also apply multiple time frames and the tool automatically tracks your trading results whenever a trade is closed. To use Forex Tester.
- 3rd party software integration with MT4 is a neat solution because that way you can backtest strategies that use custom proprietary indicators as well. The F12 function key method MT4 has a built in function to shift the chart by 1 candle at a time.
- Find Robust (MT4) Trading Strategies That Work Over Many Years and Perform In Live Market Conditions. A Successful Strategy Example With Backtest That Has Been Trading 4+ years on Live Account.
The great part about MetaTrader 4 is that you can create automated trading strategies called Expert Advisors (EAs) and backtest them in the built-in Strategy Tester. If a strategy works well after thorough testing, the next step is to start testing it in a demo account to see if it works in real-time market conditions.
But using the Strategy Tester can be confusing when you use it for the first time. The first time I used it, I thought it was broken 🙂
So in this video, I’ll show you how to go from beginner to pro, when it comes to backtesting automated trading strategies in MetaTrader 4. Learn how to do a quick test, use the strategy optimizer and use visual mode.
If you want to learn how to use the MT5 version of Strategy Tester, you can find that tutorial here. You can also learn more about MT4 by going through these tutorials.
The text version of the video is provided below the video.
How to Setup the MT4 Strategy Tester
Before you do anything in Strategy Tester, make sure that the EA you want to test is installed. You can do this by going to: File > Open Data Folder.
Backtesting Trading Strategies Mt4 Login
From there, open this folder: MQL4 > Experts. Then drag your EA file into that folder.
You can also check to see if the EA is already installed.
Once your EA is installed, restart MT4.
Now that your EA is installed, open MT4 and click on the Strategy Tester button. This feature is NOT available in the mobile version of MT4.
The Strategy Tester window will appear at the bottom of your screen. You are now ready to do your first test of your EA.
How to do Your First Backtest in the Strategy Tester
Here is an explanation of the settings:
- In the first box, select your EA from the dropdown list.
- Symbol: Select the symbol that you want to backtest on.
- Model: Use the default Every tick setting.
- Use Date: Leave this box checked and select the From and To dates that you want to use for this test.
- Visual mode: Leave this box unchecked for now. You can also ignore all of the settings immediately to the right of this box. They will be grayed out anyway.
- Period: Select the timeframe chart that you want to test from the dropdown list.
- Spread: Leave as Current.
- Expert properties button: Click on this button to change the settings of the EA.
- Symbol properties button: You won’t have to use this button in this tutorial.
- Open chart: Only click this button after a test has been completed.
- Modify expert: This is only used to modify the source code of the indicator. You won’t need this for your first test.
- Optimization: Uncheck this box. We will get into optimization later in this post.
Once everything is setup, then click on the Start button.
Alright, this is where things may get confusing…
When you first start the test, the green bar will move from left to right. This first pass shows that the data is being loaded.
Then the green bar will reset and start moving from left to right again. This is when it’s actually testing.
You won’t see anything happening on the chart. MetaTrader 4 is testing in the background.
This is the fastest way to backtest because it doesn’t have to constantly update the chart. If you want to see the results in real-time, go to the Graph tab at the bottom of the screen. That will show you the results of every trade, as it happens.
You can also look on the Report tab to see the stats on your test.
The Results tab will show you all the trades that were taken.
Once the test is completed, you can click on the Open chart button and you will see of the trades that were taken.
This chart can help you understand if your trades are being executed as you expected.
When you double click on a trade in the Results tab, and you have the chart marked with your trades open above, the chart will jump to that trade.
That’s the fastest way to backtest your EA.
Another way to backtest is to use visual mode…
How to Use Visual Mode in Strategy Tester
Visual mode will open a chart and show you the execution of every single trade.
In order to use visual mode, simply check the Visual mode box before you click the Start button on your test.
This is what you’ll see on your chart.
Once the data loads, you’ll see the chart and the price will start changing. In order to speed up the process, move the slider next to the visual mode box all the way to the right.
Even at “full speed” the chart will move pretty slowly. So you might wonder what the benefit is to using this mode.
The primary benefit is seeing how your strategy executes in almost real-time.
When you look a the code or to a standard backtest, it can be difficult to see where the EA is making mistakes or how your settings are affecting the results.
But sometimes when you see trades executing as price moves, the issues become very clear.
Therefore, this method of testing is not geared for speed, but it’s a way to visually spot issues or optimizations.
MT4 Strategy Tester Optimizer
Now that you have a good feel for how the Strategy Tester works, you can start optimizing some of your parameters.
It would be great if there was some sort of fancy AI powered optimization algorithm, but unfortunately there isn’t.
Strategy Tester uses a very simple iterative process of trying different EA settings and showing you the results.
But that can be a good thing. When you use an AI, you don’t quite know what it’s doing in the background.
With the MT4 optimization process however, you know exactly what’s happening and identifying the best settings is a straightforward process.
To use the optimizer, click the Optimization box before you start the test.
The way that MT4 optimizes your EA settings is by allowing you to set a starting, ending, and step up value for each of your EA settings. For example, here are the settings that are available for the EA that I’m using in this example.
For each setting, you can set the following:
- Checkbox: The parameters that are checked are the ones that will be optimized.
- Value: The value used for normal testing.
- Start: The start value used for optimization. This value is not actually tested.
- Step: The increments that are used in each of the tests. In this example the step is set to 10, so the value for this input will increase by 10 on each successive test.
- Stop: This is the final value that will be tested during optimization.
Just to clarify how this works…
If you use a starting value of 10, a step value of 10 and stop value of 30, MetaTrader 4 will test 20 and 30 only. It will not test the starting value of 10.
Also keep in mind that the more inputs you test, the longer your optimization tests will take.
Therefore, it helps to start off by testing one input at a time and use larger step intervals. Once you get an idea of what works, you can start to fine tune the settings.
After you get results that you like, be sure to do one last test with the normal Strategy Tester settings to make sure that all of your new settings work well together.
Where to Get MT4 EAs
There are many places that you can get MT4 EAs.
You can start by taking a look at the MetaTrader EA repository. This will give you a good idea of what is out there.
However, you’ll quickly see that there are a ton of EAs, but you don’t know how most of them trade. If you don’t know how they work, how will you know when they stop working?
Therefore, the best thing to do is to learn a trading strategy, test it, then create your own EA.
Even if you don’t know how to program in MT4, you can always find a programmer to create an EA for you.
I’ve used several programmers over the years and they were able to create exactly what I wanted.
To see the programmers I use, go here.
The Difference Between .MQ4 and .EX4 Files
You may notice that there are two different types of EA files. This section will explain the difference.
There are two different types of files because there is one file that humans can read and one file that that MetaTrader can read.
The file that human programmers can read (the .mq4 file) is not very efficient in terms of processing speed, so it’s converted into a version that the computer can use efficiently (the .ex4 file).
These files are also known by the following names:
- .ex4 = compiled, program or executable file
- .mq4 = source code file
When you add a .mq4 file to MT4, it will automatically be converted to a .ex4 file, when you open MetaTrader 4.
If you purchase an EA on the internet, it will usually come in .ex4 format. This is because the .ex4 file hides the developer’s programming and doesn’t allow others to copy the code and resell it.
However, if you create an EA yourself, or you work with a programmer to create an EA from scratch, the EA will be in .mq4 format.
One final note on these files…before working with a programmer, be sure that they will give you the .mq4 (source code) version. That shouldn’t be a problem since you’re paying them.
But double check before you start working with them.
To get help with finding a MetaTrader 4 programmer, I have created this guide and list of programmers.
…and no, you cannot use MT4 files with MT5, and vice versa. This is a common question.
A Final Word of Caution
Finding an EA that will make you money while you sleep is a sexy idea. But remember that there are no free lunches in trading.
You can still screw up an EA that has been profitable in backtesting.
Here are a couple of ways that you can do that.
First of all, you have to decide when to turn on your EA.
That may sound obvious, but when an EA hits a losing streak, it can be very tempting to turn it off to stop the bleeding.
…and when you turn it off is usually when it starts working again…or so it seems.
So remember that you have to understand the statistical characteristics of your EA, so you know when it is doing something that’s out of the ordinary.
For example, if your backtesting shows that you should only have a maximum of 5 losses in a row, but your EA has currently lost 10 trades in a row, then it’s probably time to turn it off and evaluate what’s going on.
However, you certainly shouldn’t turn it off after 6 losses in a row, no matter how mentally painful that is. Based on your stats, that’s usually the time when it should start winning again.
Second, many new traders don’t test their strategy enough and jump into live trading too quickly.
There are many variables that can affect the performance of an EA in live trading, so be sure to “stress test” them all before you risk real money. Test it with a wide spread, multiple pairs and use as much historical data as possible. Six months of data is not a valid test.
The more robust your testing, the more likely your EA will work in live trading.
Now get to work testing 🙂
Related Articles
Scalping Strategy Course (DVD + Online) - $299.00 In the much anticipated Forex Scalping Strategy Course, Vic and Sarid show you short-term focused techniques and strategies to make quicker profits while reducing market exposure. |
Forexmentor Coach's Corner First Month (Online) - $149.00 The Coach's Corner offers 2 live sessions per week, an integrated approach to trading, FREE access to the VicTrade video course and Darko's Pattern Trading Video Lessons. |
Backtesting Trading Strategies Mt4 Free
Welcome to our brand new Go Forex YouTube channel, This tutorial will show you how to accurately backtest any expert advisor on your MetaTrader platform.
Get our News trading Ea free! Click the link below!
https://app.getresponse.com/site2/goforexltd?u=wUOdC&webforms_id=SvMaj
Everything is Free and can be set up within 5 minutes
Link to Tickstory website – https://tickstory.com/download-tickstory/
—————————————————————————————————————-
If you are a Forex Trader, why not check out our News Trading strategy, it is very simple and we are giving it away COMPLETELY FREE.
Click the link below to join our email list and get your FREE COPY. https://mailchi.mp/192af5de873d/signupform
Official Score | 17 wins – 2 loss
For more information about our strategy, WHY IT’S FREE? and who we are, visit our website.
https://mailchi.mp/19ca8ffe309d/goforex
source