What are you expecting as answer with the information provided ?
Fix your code.
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.
We can't see your broken code.
Fix your broken code.
With the information you've provided — we can only guess. And you haven't provided any useful information for that.
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.
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.
Thanks a lot Fernando,
that was precisely the cause.
It solved my problem, thanks!
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.
We can't see your broken code.
Fix your broken code.
With the information you've provided — we can only guess. And you haven't provided any useful information for that.
I didn't expect anything but advice or comments from people more expert than me in the field and this is exactly what happened with Fernando, well, look at that.
Enjoy repairing your crystal balls.
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.
Do I understand correctly ?
You are saying that the above code when optimized (custom max), should (could ?) return different values ?
input int SomethingToOptimize = 0; int AGlobalVariable = 17; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { AGlobalVariable++; //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Tester function | //+------------------------------------------------------------------+ double OnTester() { //--- return(AGlobalVariable); }
If yes, in what circumstances ? Because I can't reproduce it.
Maybe I misunderstood your point.
It is not what he meant indeed, hence the reason for me to delete my post. You are fast and beat me to it.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I created an EA which makes trades if some conditions are satisfied and I'd like to optimize two parameters - the SL (in pips) and the risk-to-reward ratio - which do not affect those conditions.
However, when I perform backtest, I see that for most of the combinations no trades are actually opened, as can be seen from the first of the attached figures.
This is unexpected since, as I said, the opening of a particular position is independent of the quantities I'm trying to optimize.
In addition, if I try one of those combinations (e.g., the first one) on a single backtest without optimization, the trades are correctly opened, and I get the result shown in the second attached figure.
Why does that happen?
I got the same result with different optimization strategies and modelling (i.e., every tick, 1m OHLC, etc.).
Thanks,
Alessandro