Whats largest size array we can effectively use in mql4?

To add comments, please log in or register
nadiawicket
965
nadiawicket  

Need to compare every single bid of last month for some calculations (about 2 million values just for EURUSD alone).

Putting them all in an array (need to do so for 31 instruments) seems too clunky. Any better way?

I have been just writing bids to a file, then using bash on the file (where I can just compare lines instead of dealig with arrays).

Any native mql4 solution? Don't wanna need bash for anything.

Maybe mql5?

lippmaje
862
lippmaje  

Maximum size of an array is about 2 billion values. A double consumes 8 bytes, 2 million ~16 MB.

The documentation on ArrayResize says: Total amount of elements in the array cannot exceed 2147483647.

nadiawicket
965
nadiawicket  

Will go right ahead then and hope for best with my 4gb ram !

Thx

rrocchi
174
rrocchi  
nadiawicket:

Will go right ahead then and hope for best with my 4gb ram !

Thx

You can do the same file operations using Mql4 code, instead of bash, MQL4/MQL5 can do any operations inside any file. Better yet, you can define your custom structure, and it uses your custom file structure during the file operations. 


https://docs.mql4.com/files/filewritearray

FileWriteArray - File Functions - MQL4 Reference
FileWriteArray - File Functions - MQL4 Reference
  • docs.mql4.com
String array can be written in a TXT file. In this case, strings are automatically ended by the line end characters "\r\n". Depending on the file type ANSI or UNICODE, strings are either converted to ansi-encoding or not. //|                                          Demo_FileWriteArray.mq5 |...
To add comments, please log in or register