Trading Strategy Backtest: How To Do It Right?

Trading strategy backtest

In this article, I will show you how to place an Expert Advisor on Meta Trader and how to perform a backtest. Hello traders! this is Petko Aleksandrov and today I will demonstrate how to perform properly the Trading strategy backtest on MetaTrader.

The first step after you have the Expert Advisor is to go to File, Open Data Folder,

trading strategy backtest
Go to File then Open Data Folder



and Experts.


Paste the Expert Advisor here and close the folder.

After that, go to the Navigator tab, right-click over Expert Advisors and click on Refresh.

trading strategy backtest
Right-click on Expert Advisors and click Refresh

This will compile the Expert Advisor and you will see it listed below. And if you are using Meta Trader 5 you will need to right-click over the Expert Advisor and go to modify.

Right-click over the EA and click Modify

This will open the MetaEditor from where you can compile the Expert Advisor.

The MetaEditor

Here you can see if there are errors or warnings for this trading strategy backtest. After you have compiled the Expert Advisor, you can drag it over the chart and drop it.

A small menu pops up with the inputs of the Expert Advisor, the parameters of the indicators, and the strategy properties.

trading strategy backtest inputs
The small menu

At the bottom, you have the magic number which allows you to track the performance of the Expert Advisors. This is very useful if you are trading with many Expert Advisors in one account.

Remember to enable the AutoTrading if you want to trade with the EA. But if you do a trading strategy backtest it could be off.

Also, we would suggest you test any Expert Advisor first on a Demo account before placing it on a real account. From the entry lots, you can change the trading quantity that you would like to use, and you can change the Stop Loss and the Take Profit.

And you can change any of the parameters in the indicators. In this case, this Expert Advisor was created for EURUSD and for the M15 chart. So you have to place it on the exact same timeframe, on the exact same currency pair. Click on OK and you will see the smiley face in the right upper corner.

The smiley face

This means that the Expert Advisor is attached to the chart. Don’t forget to enable the AutoTrading before placing the Expert Advisor otherwise you will see a sad face and this shows you that the Expert Advisor is not working.

Now, if you want to do a trading strategy backtest you can right-click over the chart, go to Expert Advisors, and hit on Strategy Tester.

trading strategy backtest
Strategy Tester

You will see a window opening below the chart from where you can select the Expert Advisor you want to backtest, the symbol, the model which gives you the 3 options – Every tick, Control points, and Open prices only.

trading strategy bactest method
Model options

Our suggestion is for you to use Open prices only for trading strategy backtest

Usually, in Meta Trader, Every tick is not a very accurate method for backtesting Expert Advisors since the Meta Trader algorithm for backtesting tick data is not very accurate and it causes a lot of problems for the traders.

For this Expert Advisor and for all Expert Advisors that are created with Expert Advisor Studio, we would suggest you use Open prices only. This is because the Expert Advisor works on the opening of the bar. In other words, the Expert Advisor checks for entry and exit signals on the opening of every bar.

And this is the fastest method which actually turns out to be the most reliable method. Because it simplifies the Expert Advisors and it makes the trading strategy backtest on Meta Trader extremely fast. As well, you have the option to use date.

If you uncheck the box, it means that it will use the complete historical data that is available on the chart.

If you just open a Demo account with any broker, it is a good idea to press the HOME key on your keyboard and hold it.

Press the HOME key on your keyboard to get more data

This will force Meta Trader to load more bars so you can have a longer backtest. On the right side, make sure to choose the right timeframe and the spread accordingly.

Choose your period and spread

Click on Start and you will see how quick is the backtest on Meta Trader.

In Results, you can see all the positions that opened and closed and the final trading strategy backtest result. On Graph, you will see the strategy backtest graph.

The graph

As well, you have Report which shows you some more statistics from this trading strategy backtest.

trading strategy report

In Journal, you will see if there were any errors during the backtest or not.

In this example, there were no errors during the backtest. Keep in mind that the backtest shows the results of this trading strategy for the past period of time which does not guarantee profits in the future.

This is why we would suggest you place this Expert Advisor on a Demo account to see how it performs on the current market conditions. And make sure to test the Expert Advisor until you feel comfortable placing this Expert Advisor for trading on a real account.

The other option to a tradibg strategy backtes is with EA Studio

To give you an idea how this Expert Advisor works, I will open EA Studio from where it was created. This is a strategy builder that allows the traders to automate their trading strategies with one click because we have the option to export Robots for Meta Trader 4 and for Meta Trader 5.

trading strategy backtest with EA Studio
Export EAs for Meta Trader 4 and Meta Trader 5

This strategy uses the stochastic signal and the rule is – Stochastic line crosses the signal line downward. As an exit rule, we have – The bar opens above lower band after opening below it. As well, we have Take Profit of 20 and Stop Loss of 80.

Don’t be scared that the Take Profit is smaller than the Stop Loss. This is because the balance chart shows profit. And as well, the statistics that we have are very promising, we have a good return to drawdown and we have over 2,500 count of trades that were executed.

And if I click on Report, you will see some more statistics that I have for this trading strategy.

trading strategy backtest results
The report

EA Studio is open for everyone to use it. You can generate your own strategies or you can generate new strategies or you can use the strategy editor from where you can add different indicators as entry and exit rules and you can see how the strategy performs immediately.

EA Studio free trial allows you generate and autoamte strategies

Even if you make a small change, for example, if I lower the Stop Loss to 70 pips, I will see immediately the backtest of this strategy which saves a lot of time testing on a Demo account. It allows the traders to automate their strategies that are only showing nice and stable profit lines.

As well, EA Studio comes with free 15 days trial which you can use to export an unlimited number of Expert Advisors for Meta Trader 4 and for Meta Trader 5.

Thank you for reading. If you struggle to make a trading strategy backtest, you can write in the comments below and we will help you.

Have a great day.