MetaTrader Optimization

Metatrader’s Strategy Tester allows you to optimize your expert advisor to find the most profitable settings for the multitude of possible input variable combinations. You can optimize an expert advisor on a specific chart for a specific time period to find out which input values produced the highest returns and lowest drawdown.

However, it is important to remember that you should not over-optimize. You may get amazing results with a specific input combination, but because the values are so constrained, you probably won’t see results like that in the future. When optimizing an expert advisor, remember to use your head and think about why you are getting the results you are. Was it from one huge winner that you are unlikely to see in the future? Or did it win many times, making it a plausible trade setup for the future.

Don’t forget, you need to have high quality minute data for optimization to be worthwhile. See the article on setting up your metatrader history data.

How To Optimize – Step By Step

To get started optimizing your expert advisor, open Strategy Tester. If you are new to backtesting, read the article: How to Backtest in Metatrader

Select the Expert Advisor from the pull down menu. Choose a currency Symbol and Period. Select Every Tick for Model. Check Use Date and select a time frame that you have high quality minute history data for. Finally check the box next to Optimization.

Next, click on the Expert Properties button on the right. Select the INPUTS tab to enter the range of values you will optimize for. The Start value is the lowest value that you start from. Stop is the highest. And Step is the increment that you step through the range.

For the TakeProfit value, you can see that we start at 50, step through at 25, and stop at 300. This will test every value inbetween 50 and 300 in a 25 increment. So, 50, 75, 100, 125, all the way up to 300. The same idea applies to the other variables.

The checkbox on the left must be checked to optimize for that variable. Otherwise, it will use the regular Value.

When you’re finished entering your input values, click OK. Now we’re ready to start the optimization. Click the Start button on the bottom right of the Strategy Tester window. The backtest may take minutes or hours depending on how many values you are optimizing for. You may want to choose a larger increment Step value or a smaller range if it is taking too long.

After the optimization has completed, select the Optimization Results tab to look through the results. You can sort by the values at the top. Select Profit to view in order of highest returns, or Drawdown to see which values had the least risk.

Original article source: The Trade Machine (c)

6 thoughts on “MetaTrader Optimization”

  1. Enormously beneficial many thanks, I believe your subscribers could perhaps want significantly more blog posts such as this continue the great effort.

  2. Hi Alan,

    I found your site while trying to figure out this optimization stuff. My question is, what is the significance of the numbers in the lower left corner in the strategy tester right above the settings tab. Once you start the optimization I see 1/1280 (320). I have figured that these are the passes it is trying to make with 1 being the current pass. the other 2 numbers are baffling me. Is 1280 the total number of passes or is (320)? These numbers never seem to match up with the end report either. Sometimes, if I am running a large test with lots of parameter changes it will stop at 10,000 instead of completely finishing all passes which can number in the millions (only when “model=control points” for speed). Any ideas would be appreciated!


Comments are closed.