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
Of course cache is a great and absolutely correct idea for CopyRates() process. No doubt.
All what I'm searching for is a little bit more flexability working with cache. Like CacheFree() or something. May be I'm missing something in MQL5 world?
Regarding particulary my case, as I already said I need to test about 1000 CFD symbols on different timeframes. CopyRates() for each kills my memory very fast. Particulary in my case I would be happy to clear that cache after each symbol test.
I have about 1000 CFD symbols to scan. In various timeframes for each. A lot of memory required)
If you have trouble with this causing too heavy a load i recommend you to declare the variables in a designated function itself so that it get's destroyed after you exit the function call and you only have to store the outcome of the calculation.
There is no need to call and keep it all since you are only interested in the outcome of the calculation (usually).
This way you can keep it feather-light and blazing-fast.
Otherwise it can get bulky and sluggish real fast.
If you have trouble with this causing too heavy a load i recommend you to declare the variables in a designated function itself so that it get's destroyed after you exit the function call and you only have to store the outcome of the calculation.
There is no need to call and keep it all since you are only interested in the outcome of the calculation (usually).
This way you can keep it feather-light and blazing-fast.
Otherwise it can get bulky and sluggish real fast.
In theory, it should not change anything compared to the posted code, as arrays are already declared locally in the for loop scope which is equivalent to a function call in matter of scope.
And anyway, if the underlying issue is a cache issue, it will not change anything, as it's not related to variables declaration.
Exactly! May be I was not clear enough. The problem that CopyRates() create cache in memory (what is good), but it's not getting destroyed if we don't need it anymore. And this is a problem for me.
Here is a new version of script, more informative:
Possible output for FIRST run after terminal launch (all the rest would return zero because of already cached data):
This caching mechanism is normal for EA testing.
The MT5 terminal will release the memory occupied by the cache after 5 minutes if the tester agent does not receive a new test task.
It has nothing to do with the use of the CopyRates() function.
But I don't know how a script works, or whether is it related at all...
This caching mechanism is normal for EA testing.
The MT5 terminal will release the memory occupied by the cache after 5 minutes if the tester agent does not receive a new test task.
It has nothing to do with the use of the CopyRates() function.
But I don't know how a script works, or whether is it related at all...