So calculate it in OnInint()
In MQL4 I was reading data from file in the inite, but it took a very long time. I don't know if the initeis used with each new pass or not?
I found it on the forum, each time the inite is used, i.e. the array will be recalculated.
Of course not.
Oops... Didn't read carefully and misunderstood the question.
In MQL4 I was reading data from file in the inite, but it took a very long time. I don't know if the initeis used with each new pass or not?
I found it on the forum, each time the inite is used, i.e. the array will be recalculated.
It's elementary. You check the size of the array at each run. If the array is empty or the calculation flag is false, you recalculate it:
if(ArraySize(optimize_array) == 0) CalculateArray();
It's elementary. You check the size of the array every time you run it. If the array is empty or the calculation flag is false, you recalculate it:
I haven't checked it yet, though. But, I ask and that the array will be saved from the first pass (where it will be calculated) and will be available in subsequent passes?
I haven't tested it yet, though. But, I will ask and that the array will be saved from the first pass (where it will be calculated) and will be available for subsequent passes?
It won't. You have to recalculate it, or save it to a file and read it out.
So I have a dilemma: how to make it possible to read from a file once, fill an array with it and use this array on all passes.
I need it to reduce the optimization time, because the array will always remain unchanged and it will be expensive to read it every time.
So I have a dilemma: how to make it possible to read from a file once, fill an array with it and use this array on all passes.
I need this to reduce the optimization time, because the array will always be unchanged and it is expensive to read it every time.
Resource attachment. Don't ask how. I didn't write the source code.
It will have to be read in the inite. But it won't be read from disk, but from memory. So, in fact, the array will be in memory.
In MT5 there is an event to start optimization, in it calculate the array, save it to a file, and in the init of the EA read 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
There is an array that does not change during the whole optimisation. Is it possible to calculate it once and only refer to it on each pass during the whole optimization without calculating it again?