How to backtest EA
In this article, I will show you how to backtest EA online on MetaTrader or in other words, how to see the performance of the Expert Advisor. As I showed in the previous lecture, the Expert Advisor is a trading strategy that is automated.
So in this account, I have now 13 Expert Advisors. I’ve been trading with 12 of them. And I have added one more, which I have displayed over the chart, placing the indicators. But as I have concluded, it is really hard to follow the Indicators manually. We need to spend a lot of time in front of the screen. So the best solution is to trade with Expert Advisor.
Now, when you get an Expert Advisor, no matter where you get it, whether you buy it from the market, whether you create it by yourself using strategy builders, or you code it, or you take it from our course, you have backtest EA. This way you will be able to see how this strategy performed with your broker.
Backtest EA on Different Brokers
Now, we test the Expert Advisors on a few brokers. Obviously, we can’t test them with all of the brokers. There are thousands of brokers around and that is why the best thing you can do when you have an Expert Advisor is to perform backtest EA on your broker.
And if you do actually a backtest on a few brokers, you will see how different the results are.
In our courses we have demonstrated many times that if we trade with the same Expert Advisors on different brokers, we get totally different results.
It is because the spread is different on the brokers, the commission, the swap, the prices. Usually, the brokers have different liquidity providers, which simply means that they receive different prices and usually it’s a very small difference.
But when trading with Expert Advisors, we are very accurate in executing the trades and we can see that difference.
Now, how to backtest EA on MetaTrader?
First, I will need to attach the Expert Advisor over the chart so I can double-click on it, or I can drag and drop it over the chart and I will see the small input menu.
And I don’t want to trade with the Expert Advisor right now. I just want to show you how to backtest EA online. But anyway, I will attach it over the chart.
Let’s say I will be trading with 1 complete lot and I click on OK. We see a smiley face, which means the Expert Advisor is attached over the chart.
EA Backtesting with MetaTrader Strategy Tester
You see where your trades opened and closed.
Now, what I need to do is right-click over the chart and go to Expert Advisors and select Strategy Tester.
A new window will pop up below the terminal. And there we have the setup for EA backtesting on MT4. Now, what’s very important with the Expert Advisors that are created with EA Studio is to use as Model, “Open prices only”, and usually all the rest is set automatically.
You can see I have the symbol EURUSD and I have a period of M15. It’s up to you if you want to backtest EA on the current spread or you would like to put a little bit higher as 10, which I usually do, and then we can select the date. Let’s backtest this Expert Advisor for the last 2 years.
So we are in September 2020. I will just go back a little bit to September 2018 so I can backtest EA for 2 years. And then instead of today, I will select the 1st of September 2020. So we have exactly 2 years to backtest EA online. Now, below we have the Visual mode.
So if you keep it checked, you will see the actual EA backtest on the chart. Let’s see how that looks. I really like it, by the way, because it gives you a visual presentation of where the trades were opened and closed. Before I click the start button, you can see there are Expert properties, from where you can change the parameters for the backtest.
We will use 1 complete lot to backtest EA
As we said, let’s make backtest EA online with 1 complete lot.
I click on OK, and I click on Start and the chart starts to move. This is since the 1st of September 2018 and the EA backtest in MetaTrader starts after the first 100 bars, so we will see the first trades opening in a while, or if you want to see it faster, you have the Visual mode from where you can increase a little bit the speed.
What I was saying is that some strategies are more active and they open trades all the time. But that’s not always the best case because we pay more spread to the broker.
Some traders prefer to trade with active strategies. Others prefer to trade with strategies, where the trades happen rarely or we have more confirmations. This strategy is just a normal one, which has 2 entry conditions, as I showed, and 1 exit condition, Stop Loss and Take Profit. I will increase it to the maximum.
It goes fast and the EA backtest is complete. In the end, it shows the indicators that the EA backtest uses. This is exactly the Bollinger Bands, the Escalator Oscillator. And as well we have the 2 Moving Averages, which in this case are displayed with the same color.
Now, below we have a few tabs. One is the Results where we can see all the trades that happened from September 2018 until September 2020. The final balance is at 15 203, which means it’s about 50% of a profit, or that would be $5203.99.
And if I go to the Graph, you’ll see the equity line of that strategy.
It started at 10 000 and had a couple of drawdowns and stagnations. It reached to 16 555 and it ended at about 15 200. So that’s quite a normal strategy, again I say, an Expert Advisor with profitable periods and losing periods.
And every single strategy has losing phases, losing periods, or consecutive losses.
In other words, we can say that during this time, for example, the strategy was just losing. The market conditions were not appropriate for the strategy. So it did more losses instead of profits. But overall, the strategy is profitable. In the long term, that is a profitable strategy.
And really try not to look for the strategies that have a perfect EA backtest online. These are usually the strategies that the people sell on the market and they are just over-optimized, or in other words, their parameters were fit perfectly for the EA backtest to show you great results. And usually, this kind of Expert Advisors blow the accounts of the traders.
Why do we trade many Expert Advisors?
So, one more time to summarize it, every strategy has losing periods and profitable periods, and this is why we trade many Expert Advisors simultaneously. So when one of them is in a losing phase, the others will compensate for it.
This article is based on a free lecture from the MetaTrader 4 Forex Trading course + Weekly Robots course. In the next lecture, I will talk more about trading many Expert Advisors. What are the benefits? And you will see the difference when we are trading with 1 Expert Advisor or when we are trading with many Expert Advisors, you will see how different the backtest is.
So don’t hesitate to make a backtest online for any of the Expert Advisors or to compare a few brokers and see which one will give you a better EA backtest. Because this way, you will know which broker gives more profits.
Thank you for reading the lecture. If you have found it beneficial, leave a comment below and if you want to get more of our free videos, make sure to subscribe to our YouTube channel.