![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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:
For example - look at key post #2 of the thread:different results in optimization and single test
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.
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.
The thread with good discussion and some ideas related to the subject of the thread:
For example - look at key post #2 of the thread:different results in optimization and single test
Hi Sergey,
Many thanks, I will study all the threads above.
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 ?
How do you know that ?
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.