If You’ve been in the forex space you probably heard of strategy tester. It’s a handy tool built into MetaTrader that lets you test your trading strategies before you put them into practice. Strategy tester is a powerful tool, but it can be tricky to use if you don’t know what you’re doing. In this article, we’ll show you how to Backtest Expert Advisors to get the best results possible.
Table of Contents
What Is Backtesting?
In essence, backtesting is the process of testing a trading strategy on past data to determine its feasibility and efficacy. This is an essential step for anyone looking to invest in an Expert Advisor (EA), as it allows you to see how the EA would have performed under historical market conditions.
It’s also important to note that backtesting is not a perfect science. However, by using the Strategy Tester tool in MetaTrader 4 and MetaTrader 5, you can significantly increase the accuracy of your results.
Benefits of Backtesting Your EA
One of the benefits of backtesting your EA is that you can determine how it would have performed in the past. This can help you decide whether or not it’s worth trading with this EA.
You can also use backtesting to determine which settings work best for your EA. By doing this, you can optimize your EA to perform as well as possible.
Backtesting can provide valuable insights into how to manage risk better. For example, you can use backtesting to determine how much capital to allocate to each position, as well as how many positions to open and close. This can help you to minimize losses and maximize gains.
It’s also important to note that backtesting provides valuable data for testing ideas. This data can help you identify trends and patterns in the market, which can give you an edge in developing a trading strategy.
Backtesting EA can also provide insight into different time frames. By running the EA on different time frames from the past, you can see how it would have fared in varying market conditions. You can then adjust any settings as necessary to optimize the EA for different timeframes.
Backtesting can also help you to identify any potential problems with your EA. This will allow you to fix these problems before they have a chance to cause you any real-world losses.
Finally, backtesting can help you to save time and money. Using the Strategy Tester to backtest your EA, you can gain insight into its performance without spending any money. This can help you to avoid costly mistakes and optimize your trading results.
Limitations Of Backtesting EA
When it comes to backtesting a Forex EA, it is important to understand the limitations of the technique. Backtesting is only as accurate as the data used and the test conditions. This means that the results of a backtest can be affected by over-optimization, changing market conditions, and the use of historical data that does not represent the current market environment. Also, Things such as news filters dose not work on backtesting, So the results of EA that utilizes news filters could drastically change from the real thing.
Additionally, backtesting takes time and may not always provide an accurate indication of how a strategy will perform in the live market. It is, therefore, essential to be aware of these limitations when backtesting a Forex EA.
Setting Up the Strategy Tester Environment
Now that you have your EA files and expert advisor ready (You can download over 300+ Forex Robots for FREE from our website), it’s time to run your backtest. You’ll need to open up the Strategy Tester window in MT4.
To do this, first, open up the main MT4 window and then click on View > Strategy Tester or press Ctrl+R (on Windows) or Cmd+R (on Mac). Once you do this, the Strategy Tester window should appear on your screen.
Then, select the expert advisor you want to backtest by choosing it from the list of experts in “Expert Advisors”. You can change EA input parameters using “Expert properties” for your backtest in this window.
You also need to select the necessary parameters for testing. This includes selecting a currency pair, Time Frame, testing period, spread size, and amount of capital.
Next, you will need to choose between modeling types. There are two types: Every tick and Open prices only – and they both come with their pros and cons. Generally speaking, Every tick is the more accurate option as it would simulate exactly what would have happened in real-time trading conditions. But this method is also more resource intensive when compared to Open prices only, which is why many people tend to use the latter option when backtesting EAs.
You can also use tools like Tickstory to get more accurate history tick data.
When you’re done selecting parameters and setting options, click “Start” to begin your backtest. While the backtest is running, a graph will appear onscreen, showing the progress of your test. When it’s done running, you can check out the results of your test in the “Results” tab at the bottom left of the screen.
Understanding the Metrics and Parameters for Backtest Expert Advisors
Strategy Tester is a powerful tool that can help you backtest your Expert Advisors (EAs) to ensure they are profitable. It allows you to set certain parameters and metrics to analyze your backtest results.
You need to understand what these metrics and parameters mean to get the most accurate results. The most important ones are:
- Expert Advisor – select the expert to be tested in the list. The expert must be compiled and placed in the /EXPERTS directory. All newly created experts will be automatically placed into this directory;
- Symbol – select one of the securities available;
- Period – select the symbol timeframe;
- Model – select the method of bars modeling:
- Every tick (based on all available least timeframes with fractal interpolation of every tick);
- Control points (based on the nearest less timeframe with fractal interpolation of 12 control points);
- Open prices only (fastest method to analyze the bar just completed);
- Spread – the price history stored in the client terminal includes only Bid prices. On default, to model Ask prices, the strategy tester uses the current spread of a symbol at the beginning of testing. However, a user can set a custom spread for testing in the “Spread” field.
- Use date – use a range of dates when testing. If this option is enabled, the data from the given range will be used during testing. Otherwise, all available data for the given symbol and period are used;
- Visual mode – enable the mode of the visual displaying the test process on a graph. You can adjust the testing visualization speed using the lever to the right. You can also specify a date in the “Skip to” field to skip visualizing the test till that date.
- Optimization – enable the expert parameters optimization mode. More details about expert parameters optimization can be found in the section of the same name;
- Expert properties – open the “Expert Properties” window that allows managing the expert parameters when testing and optimizing;
- Symbol properties – view the symbol parameters. These data are given in the *.FXT file heading and used to emulate the server operation;
- Open chart – create a new chart window for the symbol selected for testing. When being tested, the expert works with a virtual chart. Signs of opening and closing of positions, objects, and indicators used by the expert are imposed in this chart. This chart can be opened only after the expert has been tested. For the opening of a virtual chart, the TESTER.TPL template is used, and if it is unavailable, the default settings are used. You can also give a template the same name as that of an Expert Advisor. In this case, that exact template will be used when opening the chart of the Expert Advisor;
- Modify expert – open the “MetaEditor” and edit the selected expert. This is useful if there is a need to introduce small changes and recompile the expert fast;
- Start – start testing or optimization. After this button has been pressed, one can estimate the speed of testing or optimization in the progress bar in the lower part of the window. After the testing starts, the “Start” button will be replaced with the “Stop” button. Having pressed this button during testing/optimization, one can stop the process.
By understanding these metrics and parameters, you can set them to maximize the accuracy of your backtest. For example, you can increase the backtest period to gain more reliable results. You can also adjust the lot size and maximum trades to ensure that your EA trades within your desired parameters. Finally, you can adjust the spread and slippage to account for the current market conditions.
Analyzing Your EA’s Performance
Once you’ve completed the backtesting process, it’s time to evaluate the results. The MetaTrader 4 Strategy Tester will let you analyze your EA’s performance by providing critical metrics such as profit factor, drawdown, win rate, and average win and loss.
By looking at these figures, you’ll be able to gauge if your EA is profitable or not. You should also consider experimenting with different parameters to find the best settings for your EA. That way, you can optimize the performance of your EA and get the best possible results in live trading.
Tips for an Effective Backtest of Your EA
Once you’ve chosen the settings for your backtesting environment, there are a few tips you should keep in mind to make sure that you get the best results.
First off, choose an appropriate time frame. This should be based on the length of the trading system that your EA is based on. For instance, if it’s a day trading system, a shorter time period, such as a few weeks or months, would be more appropriate. On the other hand, if your EA is more of a long-term system, you’ll want to use a longer time frame, such as years.
Second, use realistic settings and data. Make sure you’re using real market data with realistic spreads and slippage settings to get accurate results.
Recommend using a tool like Tickstory to get more accurate history tick data.
Finally, make sure to adjust the settings as needed. Take into account any changes in the market or other factors that could affect the performance of your EA before running another backtest. This way, you can make sure that your testing is always up-to-date and accurate.
Common Pitfalls When Backtesting Your EA
When backtesting your Expert Advisor, it’s essential to be aware of the potential pitfalls. There are a few common mistakes that can lead to inaccurate results.
First, make sure you are using enough historical data. Using only recent data is not enough; it may not give you a full picture of what the EA can do. However, using too much historical data may make it harder to recognize trends and patterns in the market. It’s best to strike a balance by using a good amount of data that is relevant and up-to-date.
Another thing to remember is that even though you are using historical data, markets change over time. Therefore, it’s essential to adjust your backtesting parameters accordingly to reflect those changes – such as different trading hours or different trading rules – so that you can get an accurate reading of how your EA might perform in the present market conditions.
By keeping these tips in mind, you can ensure that your backtesting process yields the best results for your Expert Advisor!
Troubleshooting Common Issues With Backtesting an EA
When it comes to backtesting Expert Advisor, troubleshooting common issues is a reality you may need to face. This can include anything from incorrect data, incorrect settings, or even an EA that is too slow or fast.
Fortunately, you can follow a few easy tips to help identify and solve the most common problems. For example, check to ensure that the chart time frame matches the time frame of your Expert Advisor and that you have enough history data loaded in your MetaTrader 4 platform. Also, consider that higher-quality data will usually lead to better backtest results.
Additionally, make sure that you test with reasonable lot sizes – this could also affect your backtest results – and always keep in mind that market volatility can influence the results significantly when live trading. Testing under different market conditions is advised in order to guarantee the best possible results from your Expert Advisor.
Conclusion
When looking to backtest an EA, it’s essential to use the Strategy Tester tool in MT4 to get the most accurate results. By following these steps, you can ensure that you’re getting the most accurate data possible to help you make the most informed trading decisions.
There you have it! You now know how to use Strategy Tester for backtesting Expert Advisors for the best results. Remember, it’s always a good idea to test your EA on a demo account before using it on a live account and to keep an eye on your results to make sure your EA is performing as expected. Good luck and happy trading!
[…] Unfortunately, This EA doesn’t work on strategy tester. […]