![Documentation on MQL5: File Functions / FileWriteArray Documentation on MQL5: File Functions / FileWriteArray](https://c.mql5.com/36/47/documentation-on-mql5-file-functions__2.png)
- www.mql5.com
Then write your own Write (or Read) function, that loops through the array elements and writes (or reads) them individually. Then just reuse that function in the rest of your code.
Coding is about creating "recipies" for your code problems. If the function does not exist, you create it. It is all about problem solving by dividing the problems into smaller chunks and creating mini solutions for them. Then combining it all in the overall "recipe".
You can, but it will not be as efficient, both in disk usage and CPU usage as there will be a "binary to text" and a "text to binary" conversion taking place respectively for writing and reading.
EDIT: An example of what you are suggesting is the typical CSV files that can easily be read by most Spreadsheet applications. So there is an advantage to that but it is more resource heavy.
As long as you handle it properly, there is no problem mixing binary data (for ints and doubles) and text data for strings in the same file. As longer as it is properly structured, either as fixed field size for strings or by using dynamic length string text (using a size header or NULL ending).
It is all about following a logical and reproducible "recipe" for the handling of the data.
Instead of asking, experiment for yourself and find out! The best way to learn is by gaining the experience instead of asking others to provide you every single step for all of your queries. Learn by doing! Even if you do something wrong, you learn from the error and become a better coder for it.
Thanks Dominik.
Here is a code snippet to find out how fast a code is executed.
const ulong perf_start = GetMicrosecondCount(); /* Here goes your code to be examined */ printf("Execution time: %llu microseconds.", GetMicrosecondCount() - perf_start);
If the result sis NULL then your code is executed below one millionth of a second, which is very possible. If this happens, you should include your code in a loop to iterate the code a multiple of 10, this way you can still measure the execution time. and divide it by the iterations used.
Results mya vary, depending on your systems load and the ability of the operating system to assign ressources to your thread/EA.
Hope this helps.
BTW: Why not look into the sources and see yourself how the developer has solved reading/writing a file. At least this way you can make a conclusion on the options in use to perform the task.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello guys
My ea creates 2 dimensional structure dynamic array while it is running.
How I can save this array into a file and read this file OnInit to recover array, if ea removed and added to terminal