MT5 tester bug: same conditions, different results - page 2

 
Alexander Kalinkin #:

Hi Sergey,

Yes, my EA works on every tick. However, I use time range with latest date in the past (e.g. 01.01.2016-05.05.2023) so the MT should not add automatically new ticks to the testing volume.

Please find below the example: I ran optimization with change in only magic number. All the results but one are the same, one is wrong.


What's wrong here? Why one result is different? It's only magic number, nothing more.
If I re-run this one (double-click and run the single test) this will show normal result as others (958 trades). But here in optimization results it is obviously wrong.

Can you reproduce it, if you run an other optimization with other magic numbers, do you still have such outlier ?

If you do the same with a standard EA provided with the platform (Moving Averages for example), do you still have this issue ?

 

The thread with good discussion and some ideas related to the subject of the thread:
different results in optimization and single test  

For example - look at key post of the thread:

Forum on trading, automated trading systems and testing trading strategies

different results in optimization and single test

Fernando Carreiro, 2023.06.21 16:21

99% of the time it is due to a bug in the EA code.

One possible cause that used to happen to me, was about Globally scoped variables not being properly initialised in the OnInit().

Forum on trading, automated trading systems and testing trading strategies

No trades open during strategy optimization

Fernando Carreiro, 2023.02.24 14:08

One common cause for optimisation passes to be different from individual back-test runs, is globally scoped variables that are not properly initialised in functions and only initialised in their global declarations.

The reason is that the EA's global variables are not reinitialised based on their declarations on every new optimisation pass (I don't know if this is a bug or intentional, but it is what happens).

So, make sure you initialise all your globally scoped variables in the OnInit() event handler if they are not initialised elsewhere in other functions

However, that is just one possible cause. It is only a guess. If you want an informed answer, then you will have to provide the actual source code of the EA that has this issue.


Forum on trading, automated trading systems and testing trading strategies

No trades open during strategy optimization

Fernando Carreiro, 2023.02.24 17:23

Yes, but I not always. I don't know the exact conditions for it to be recreated.

All I know is that it happened to me often on both MT4 and MT5 in the past, until I started making sure to initialise at runtime instead of only declaratively.

EDIT: It also sometimes happened on Indicators when they reload on a chart due to a recompile. Again, not always, but sometimes.


different results in optimization and single test
different results in optimization and single test
  • 2023.06.21
  • www.mql5.com
Hello everyone. I do optimization based on real ticks...
 
Alain Verleyen #:

Can you reproduce it, if you run an other optimization with other magic numbers, do you still have such outlier ?

If you do the same with a standard EA provided with the platform (Moving Averages for example), do you still have this issue ?

Hi Alain,


Thanks for the idea.

No, I was not able to reproduce it with a simple open-sourced EA ( Moving Averages from the MT basic package).
Have no idea why at some single tests within optimization array sometimes the tester doesn't use all the available tick history.

 
Sergey Golubev #:

The thread with good discussion and some ideas related to the subject of the thread:
different results in optimization and single test  

For example - look at key post of the thread:


Hi Sergey,


Many thanks, I will study all the threads above.

 
Alexander Kalinkin #:

Hi Alain,


Thanks for the idea.

No, I was not able to reproduce it with a simple open-sourced EA ( Moving Averages from the MT basic package).
Have no idea why at some single tests within optimization array sometimes the tester doesn't use all the available tick history.

How do you know that ?

 
Alain Verleyen #:

How do you know that ?

Hi Alain, 

Just a guess from my side. I see that in general EA works as it should, just there were much less trades that in other similar single tests. Re-run of a such "faulty" test as a single test usually gives correct results. 
 

Hey guys, 

Have you found a solution for this?

I reproduce it with a simple EA - check this thread : https://www.mql5.com/en/forum/463308#comment_52588654

As soon as I use a higher timeframe I am able to reproduce it. 

I am using broker data, I will check if using third party data would have an effect or not. 

Metadrader handling weirdly data read from different time frame
Metadrader handling weirdly data read from different time frame
  • 2024.02.29
  • Grap the Trade
  • www.mql5.com
Hi, I was optimizing an EA and noticed that with the same parameters, I had different results...