EA Robots
Now you are reading
Backtesting is definitely not enough - check your machine
0

Backtesting is definitely not enough - check your machine

created Paweł MosionekJanuary 4 2018

When you decide to trade with automatic strategies, we must be aware that designing and coding the terms of the strategy is just the beginning of the road. The next step is the so-called backtesting, i.e. checking the correctness of operation on historical data. But if you thought this would ultimately give you a realistic picture of the strategy possibilities, then you are wrong ...

How backtesting works

Backtesting itself is a simulation of EA operation on historical data. It shows us how our automaton would behave with given parameters in the selected time period. The details will be determined by the environment on which we are based, i.e. a strategy tester built into the platform or external, separate software. Undoubtedly, the Tester available on the platform is the most popular MetaTrader 4.

One of the key factors in backtestingu is the quality of the data used to carry out the simulation. About that how to extend the history of quotes and where to download it we wrote in the linked article. But it must be remembered that even a very (relatively) credible historical test, which ended with a substantial profit, is for us only a message about how the strategy would behave in the past under known conditions in advance. It doesn't tell us how the machine will perform in future under conditions that are unknown. So the question is - what next?

Strategy testing

It is worth introducing certain criteria and requirements to increase the reliability of the test results, which may be reflected in the future. Choosing the longest possible time frame from which we have quotes and introducing our "best" parameters is not necessarily the best solution, but certainly a good starting point.


Be sure to read: How to test automata correctly


Tests using various parameters of the strategy that we can actually modify in the future using EA is something obligatory. For this purpose, we can use the optimization function, i.e. test execution for various combinations of settings.

But I warn against over-optimization, i.e. perfect adjustment of strategy parameters to historical data. This will give us a very optimistic equity curve plot from the backtest. However, this is certainly not going to happen again in real trade.

it's backtesting

An example of backtesting results

The range of parameters and their intervals used for optimization must have a logical justification resulting from the construction of our strategy. For example, if our EA is based on following the long-term trend and initially when designing it, we used MA with periods 50, 70, 120, let us beware of tests with MA with periodicity 1-20.

Backtesting and mix time frames

As I mentioned earlier, marking the largest range and performing the test is a good introduction. But it's worth doing a few shorter tests on the intervals that will overlap, e.g.

  • Test 1 - January - March
  • Test 2 - February - April
  • Test 3 - February 14 - June 30
  • Test 4 - June - July
  • Test 4 - January - June

ea testThis way, we learn how our strategy would behave if, for example, we had a break in trade in Forex or if we started with it at a different time than January. Thanks to this, if our strategy, for example, recorded a significant profit at the beginning of the year due to the "last breath" of the January trend, we know what would happen if we started trading after it.

We can also experiment with running tests with different spread values. We can also check how he would behave by playing only long or short positions.

The more checks we make using different, potentially real conditions, the greater the chance that the result will be close to the truth.

Analyze the play

After executing the backtester, carefully analyze the received data. Check on the chart whether the positions were actually opened in accordance with the EA assumptions. See where the transactions were concluded (what happened then with the market). Try to determine what impact on the result could be possible price slippages and spread extensions when they are realized.

The test is performed in neutral conditions, where we do not deal with variable spreads, limited liquidity, and we do not take into account the time of order execution. With some strategies it won't matter much (usually long-term trading). However, in day-trading, news trading or scalping, these details often turn out to be decisive.

The truth will tell you ...

All of the above tips can only weigh the scales in your favor. They can also show you initially what you can expect using their algorithm. It is also about minimizing the risk before entering the real market with the machine and making a quick, severe loss.

And here, the last and most reliable verifier is always the execution of the so-called forward testing, i.e. checking EA on real terms. A small deposit and minimal volume (micro- and even nano-lots) is something that will give you a final overview of the slot's potential. Unfortunately, this solution has a serious drawback - it requires a lot of patience ...

What do you think?
I like it
78%
Interesting
22%
Heh ...
0%
Shock!
0%
I do not like
0%
Detriment
0%
About the Author
Paweł Mosionek
An active trader on the Forex market since 2006. Editor of the Forex Nawigator portal and editor-in-chief and co-creator of the ForexClub.pl website. Speaker at the "Focus on Forex" conference at the Warsaw School of Economics, "NetVision" at the Gdańsk University of Technology and "Financial Intelligence" at the University of Gdańsk. Twice winner of "Junior Trader" - investment game for students organized by DM XTB. Addicted to travel, motorbikes and parachuting.