Hi,
i often test mql behaviour in a script. In this case I noticed that an array which is filled, is not initialized (and keeps old values) if executing the same script again. How can I force to have a clean environment when starting the script again?
This script filles the array with 0 1 2 3 4 5. Now changing the loop:
I would expect the array values 0 1 0 0 0 0, but Arrayprint(a1) shows 0 1 2 3 4 5. This is sometimes a bit confusing. Seems that the old values are still in memory but why after changing, compiling and executing the script again? Is there a possibility to reset the data without restarting the mt5?
Best regards
trado19
yes, but is the array still in memory with just the values changed to 0? or is the array removed from memory?
yes, but is the array still in memory with just the values changed to 0? or is the array removed from memory?
what you said is exactly how I understood it to be, however, the op has described how their script reported the array contents after it was finished and the script/program was terminated.
And I can attest to the same unexpected behaviour as the op described.what you said is exactly how I understood it to be, however, the op has described how their script reported the array contents after it was finished and the script/program was terminated.
And I can attest to the same unexpected behaviour as the op described.
- 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 often test mql behaviour in a script. In this case I noticed that an array which is filled, is not initialized (and keeps old values) if executing the same script again. How can I force to have a clean environment when starting the script again?
This script filles the array with 0 1 2 3 4 5. Now changing the loop:
I would expect the array values 0 1 0 0 0 0, but Arrayprint(a1) shows 0 1 2 3 4 5. This is sometimes a bit confusing. Seems that the old values are still in memory but why after changing, compiling and executing the script again? Is there a possibility to reset the data without restarting the mt5?
Best regards
trado19