Anyway - there is the discussion thread about it: https://www.mql5.com/en/forum/448844
- 2023.06.12
- www.mql5.com
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.
Thanks for all the responses. I feel the problem is that in optimization phase the real ticks are not being loaded exact same as in single test mode.
Why ?
Forum on trading, automated trading systems and testing trading strategies
MT5 tester bug: same conditions, different results
Alain Verleyen, 2023.06.13 20:13
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 ?
1. Bug on the usage of
MQLInfoInteger(MQL_VISUAL)
or similar statements
2. Wrong buffer constant(this was my case)
CopyBuffer(handle_KAMAs[SymbolLoop], 0, bufferKAMA, numValuesNeeded, CurrentSymbol, "KAMA")
instead of
CopyBuffer(handle_KAMAs[SymbolLoop], 1, bufferKAMA, numValuesNeeded, CurrentSymbol, "KAMA")
when filling indicators copied values
3. Conflicts/Bug on global variables and indicators handles. Try to delete them after use
I experienced the same issue with the optimization results showing different (more) profits than the actual single tests and different drawdown, sharpe ratio and all the other values.
For me the problem was starting the optimization on a Saturday, when the markets are closed and it looks like my broker is feeding different tick values into MT5 over the weekend. Once the market opened I reoptimized and then the single test are showing the same profits and values as the optimization list.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone.
I do optimization based on real ticks. When it finishes I try running single tests and compare with results I see in optimization table. They are not the same. What could the problem be?