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
Resource attachment. Don't ask how. Didn't write the source code.
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.
I think that this solution has already been suggested to you. It does not suit you?
Using third-party software to create an array?
For instance, write a script that will prepare and collect all data in an array and then write the completed array into a file. And then read this array from the file during initialization in the EA. The file can be used as many times as you need, with each run of the EA.
I think that this solution has already been suggested to you. It does not suit you?
Yeah, that's the thing, it doesn't fit. There are 15,000 passes in the optimization. And I need only once to calculate and at the subsequent passes only to address an array.
That is, I already have data in the file that are calculated ahead of time and level, and they are known to me in advance. And even reading the file each time in the init is very expensive (there are thousands of lines). I don't know about MQL5, but in MQL4 they wrote on the forum that the program passes the init on every pass.
Will it be necessary to read in the inite on every pass?
You are exaggerating, IMHO.
Yeah, that's the thing, it doesn't fit. There are 15,000 passes in the optimization. And I need only once to calculate and at the subsequent passes only to address an array.
That is, I already have data in the file that are calculated ahead of time and level, and they are known to me in advance. And even reading the file each time in the init is very expensive (there are thousands of lines). I don't know about MQL5, but in MQL4 they wrote on the forum that the program passes the init on every pass.
A classic trick from C/C++ world : you can make/convert a static array from your file (just text: double arr[100500]={1,2,3....} ) and just include it through #include.
You know, I think you are exaggerating about the costs of reading an array from a file. Every time Windows wakes up from sleep mode, it restores from the hard drive an image of its state that it had at the moment of going to sleep, including the state of all applications. Do you think there are not enough objects and information there? And how long does it take to come out of sleep like that?
You are exaggerating, IMHO.
The costs are greater unambiguously. There are two variants with unchanged indicator settings and with the same values, but already written to a file, which are dumped into an array.
The variant with the file takes many times longer to be calculated than the variant with indicator calculation in the Expert Advisor.
I was just thinking that maybe there is a way to save the array once and use it for all passes of optimization, thus relieving the load on the algorithm.
A classic trick from the C/C++ world: you can make/convert a static array from your file (just text: double arr[100500]={1,2,3....} ) and just include it via #include.
The costs are greater unambiguously. There are two variants with unchanged indicator settings and with the same values, but already written to a file, which are dumped into an array.
The variant with the file takes many times longer to be calculated than the variant with indicator calculation in the Expert Advisor.
I just thought that maybe there is a way to store the array once and use it for all passes of optimization, thus relieving the load on the algorithm.