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
Here is an example of writing and reading an array
Run it twice in debug mode and see how long it takes to write and read the array. The first run will write the array to file, and the second will read it and start printing dates from the array. Then figure out the highlighted part, if IS_DEBUG_MODE should be removed, and if IsOptimization() should be inserted in the condition.
There is a function, something like FileWriteInteger(). Identify by location, the variable must be at the beginning of the file, after reading it the pointer will move to its end, i.e. to the beginning of the array, after reading the array the pointer will be before the next variable...
An article on working with files will be published soon.
I wanted to write you that there is no article on file operations. You make them informative and lucid. I'll certainly read them when they appear.
Tried to declare an array at global level (mql4 code)
datetime T[];
fill it in the inite
When unset at start, it prints date 1971, i.e. array is empty
If I fill the array in the start, the values appear. May be the reason, that the array is re-initialized datetaime, but without it the code won't compile?
The array disappears. What I do wrong?
Tried to declare an array at global level (mql4 code)
fill it in the inite
When unset at start, it prints date 1971, i.e. array is empty
If I fill the array in the start, the values appear. May be the reason, that the array is re-initialized datetaime, but without it the code won't compile?
The array disappears. What I do wrong?
Look what the compiler says.
With such an easy move, you have defined a local array T that will vanish on exit of OnInit...
check the warning that the compiler generates.
With such an easy move, you have defined a local array T that will be lost when you exit OnInit...
It says there is already a global declaration)
declaration of 'T' hides global declaration at line 40
But, how to do it right. I had never declared an array using curly brackets before. I initialized it with zero and set its size and then filled it with the loop. Is there some other way to do it?
If I clear the datetime in the inite, the code does not compile, but writes two errors:
'{' - expression expected
'=' - illegal operation use
It says there is already a global declaration)
declaration of 'T' hides global declaration at line 40
But, how to do it right. I had never declared an array using curly brackets before. I initialized it with zero and set its size and then filled it with the loop. Is there some other way to do it?
If I clear the datetime in the inite, the code does not compile, but writes two errors:
'{' - expression expected
'=' - illegal operation use
The array declaration together with constant initialization could (and should) be done at the global level.
It says there is already a global declaration)
declaration of 'T' hides global declaration at line 40
But, how to do it right. I had never declared an array using curly brackets before. I initialized it with zero and set its size and then filled it with the loop. Is there some other way to do it?
If I clear the datetime in the inite, the code does not compile, but writes two errors:
'{' - expression expected
'=' - illegal operation use
The array declaration along with constant initialization could (and should) have been done at the global level.
Yes, I tried it and it works. And you can't do it without global level, I just did it to reduce the computational cost, to fill the array once in the init and then use the array values?
Although logically, the variables on the global level are always constant, so the calculation is performed once at the beginning of the program?
Yes, I tried it and it works. And you can't do it without global level, I just did it to reduce the computational cost, to fill the array once in the init and then use the array values?
Although logically the variables on the global level are always constant, so the calculation is performed once at the beginning of the program?
It says there is already a global declaration)
declaration of 'T' hides global declaration at line 40
But, how to do it right. I had never declared an array using curly brackets before. I initialized it with zero and set its size and then filled it with the loop. Is there some other way to do it?
If I clear the datetime in the inite, the code does not compile, but writes two errors:
'{' - expression expected
'=' - illegal operation use