backtest mt4

Backtest EA in MT4: The Reality in Trading

Backtest MT4: the only way to relay on a strategy before trading

Backtest MT4 is the proper and professional way to test any strategy before real trading. How could this be done? With Expert Advisors. For the beginners these are trading Robots that implement trading strategies. And we can backtest them on MetaTrader. In other words, we can see how they performed until the moment.

 I will demonstrate to you how Expert Advisors work and what exactly are the Expert Advisors, or the so-called Robots is the slang word, or you can find it as EA. And probably when I say EA, the younger audience will connect it with Electronic Arts, the video game company.

But actually, EA in trading stands for Expert Advisors. And these are automated strategies. As we said, they are executing the trades automatically for us, and behind 1 Expert Advisor, there is a strategy.

White writing this article I will use Expert Advisor that, I have added for EURUSD M15 on Meta Trader.

One important thing I need to mention is if a strategy is designed for EURUSD on M15, then you should be trading it on EURUSD on the M15 chart. Now, let me put this Expert Advisor over the chart.

mt backtest
Drag the Expert Advisor over the chart

I simply drag it, and you will see a small menu that comes up.

backtest MT4 robot
The input menu

We see here the Stop Loss and the Take Profit, I will explain that in a minute for the beginner traders.

The indicators matter in Backtest MT4

And below that, we have a couple of indicators; the RVI signal, Stochastic, and we have Awesome Oscillator. As well, we have the Magic number, which is kind of a unique number for each Expert Advisor, and we will use it later on in the course to follow the performance of all Expert Advisors that we will be trading with.

When we do backtest MT4 it is realistic and true when we use the proper indicators with their parameters.

So the Stop Loss and the Take Profit, for the beginner traders, are tools that are also used in manual trading. If I want to buy, for example, EURUSD at 1.11, I can place a Stop Loss at 1.1075, 25 pips lower, and I can set a Take Profit at 1.1150, which is 50 pips higher. So if the price goes to 1.1150, it will close the trade automatically, and if the price goes against me and hits the level of 1.1075, it will close the deals manually.

The idea in manual trading is that when you place the trade, you set the Stop Loss, you place the Take Profit, and you don’t touch it. So you will ignore all of those emotions that I was talking about, and you will just leave it to the market whether it will hit your Take Profit or it will hit your Stop Loss. While in algorithmic trading, the idea is different.

AutoTrading

We have the backtest MT4. You will see the whole process that I will follow to create these strategies. And all these values, the Stop Loss of 56.1 pips and Take Profit of 90.5 pips, these are not just random numbers. These are values that were generated with software, and it shows that these are the best values for this strategy, on this currency pair, on this timeframe. And you will see the strategy just in a minute.

So if I click on OK, the Expert Advisor is attached to the chart, and you should see a smiley face here, and now it is sad because I didn’t allow the AutoTrading.

When AutoTrading is not enabled

So when we want to trade with the Expert Advisor, first you need to enable the AutoTrading,

Backtest MT4 auto trading
Enable AutoTrading

and then you drag it over the chart, and you will see the smiley face.

Now, I just want to show you the backtest MT4 and to demonstrate to you this Expert Advisor. I don’t want to trade with it. I wish to show it to you. Right-click, I go to Expert Advisors, and I go to Strategy Tester.

Right-click, go to Expert Advisors, then Strategy Tester.

And you can see it selects EURUSD automatically on M15. As a model, it is Open prices only.

The symbol and model

So, in simple words, what Open prices only means is that on the opening of every bar, the Expert Advisor checks if the entry conditions are there.

Visual mode with backtest MT4

And if they are right, it will execute the trade. Now, I will not use date, I will just use all of the data that I have in Meta Trader, and I will go to Visual mode, so you will see how that works. As a spread, I will use the current spread that I have for EURUSD.

And before I click on Start, I will reduce just the speed a little bit, and I will click on Start. So you see it simulates trading back from 22nd of February, 2018.

The trading is simulated.

You see one trade was opened over here, it is a sell trade, and the price continues, and it will close the deal at one moment, then it will look for the next trade. Let me make it a little bit faster. I will try to make it at a level where it will be more visual how that works.

So the price goes in a range. The trade was closed, a new trade was opened, and then the price continues to move, opening, and closing trades. If I make it with the maximum speed, it will complete very quickly.

Now, with the Visual mode, in the end, you will see the indicators that are for this strategy.

backtestMT4 indicators
The strategy with Visual mode

So we have the Stochastic, we have the RVI, and we have the Awesome Oscillator. The strategy, in this case, is that if we want to buy, we want to see the RVI signal crossing the signal line upward. The RVI is crossing the signal line upward. It is this one over here.

backtest mt4 indicators
RVI signal crossing the signal line upward

The entry rule and the exit rule

So this is the first signal. But to execute the trade, we want to see confirmation from the Stochastic, and it should be falling. And if it is rising, there will be no confirmation. This is just a particular strategy. So what I was talking about earlier about the reppainting indicators applies here very well. It’s not clear where exactly the cross happened.

But keep in mind that these indicators are repeating. So what happened at this moment is not exactly what we see right now. As well, the Stochastic is repainting, so it’s misleading to look at it this way back in time. Anyway, this is the entry rule, and the exit rule is that the Awesome Oscillator crosses the level line upward.

So let’s say at one moment we have the trade executed. As I said, it’s tough to look back in time. But, for example, if we have the cross and we have the confirmation from Stochastic, we will buy. And then the exit will be when the Awesome Oscillator crosses the level line upward. It’s right over here.

Awesome Oscillator crosses the level line upward.

So, one more time, this is just an example, and I’m not sure if it is the exact one because it’s not visual from the chart.

The backtest MT4 – the reality

Don’t look back over the chart to try to figure out strategies because the indicators are misleading, and it’s not the reality. This is the reality, the backtest.

We have the results, so we see exactly where the trade was opened and where precisely the trade was closed. We see the Profit, the balance, and if I scroll down, I see that starting at 10,000, we ended up at 10,198.93. And this was trading with 0.01, which is the minimum quantity you can trade on Meta Trader. And we have the report where we see some statistics.

The report

For example, you can see the gross Profit, the total loss, drawdown, long position, short position, a lot of statistics, but most important is the graph.

The graph

You can see how this strategy performed. So there was a drawdown, then profits, then a little bit of a drawdown, then profits again, and it’s very normal. Every strategy has a losing period, and it has a profitable period.

The most important thing is that the strategy should give us a backtest that goes on Profit. And this is why I am trading with many Expert Advisors, not just with one.

Risk diversification

When one of the Expert Advisors loses, the others will be profiting, and they will compensate for the loss. And you will see in the next lectures what I’m talking about. But this is called risk diversification. When some of the strategies lose, the others will compensate for that. And the portfolio of Expert Advisors will have a much more stable backtest.

And, one more time, if I go to Expert properties and I go to inputs, you will see that this is trading with 0.01. Now, if I change it to a complete lot and click on Start, I will have the very same graph, but you can see what the difference is in the result.

backtest mt4 results
The graph changes

It’s 28,000 and something or even a little bit more. Let me go to the results, and if I scroll down, yeah, it’s 29,732. It is starting from 10,000. This is nearly 300% of a profit.

backtest mt4 report
The results

Expert Advisors automate the strategies

This is how the Expert Advisors work. They execute the trades automatically. This is the backtest. It’s great because we see how this strategy performed. We see the equity line, and this is the result of continuous trading, from Monday until Friday, 24 hours. And as we said, this is not possible for manual trading, as well we don’t have such reports in manual trading.

Now, the software that I am using to create these Expert Advisors shows much more information and statistics about each Expert Advisor or if we have many Expert Advisors in the account, and I will show you that in the next lectures.

Thank you very much for reading.

Cheers.

Shopping Cart