Buggy code... 4002 means you are trying to access indexes not in the array.
ERR_ARRAY_INDEX_OUT_OF_RANGE | 4002 | Array index is out of range. |
Try to pinpoint the problem using Print() statements before looping on arrays using ArrayRange() to print array dimension sizes. Also note that ALL arrays in MQL4 are static (even arrays defined in functions, regardless of if they were declared static or not), so this might be a possible cause of your bug.
There is a post discussing Excel file write/read.
https://www.mql5.com/en/forum/107448/page2
and fx1 provides some functions especially for write/read datas to/from excel files,which makes this kind of issue to be easy.
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
Hello,
I have come across a wierd bug where my data does not seem to load correctly into an array. Any help would be much appreciated. The attached code and csv faile are trimmed verision of what I am working with, but the error is still persistant in this example. What I am trying to do is load a CSV file that is 17 columns wide by 360 rows into an array called Trainingdata. If I limit the amount of iterations of my loop to less the 175 the data loads into the Array fine, but the first 15 rows are all zeros and I get a 4002 error. If i increase the iterations to 360 then the advisor breaks down and loses the first 100-150 rows of the Array and I wind up with a 4002 erro, which at that point disable the full verision of my advisor. The really wierd thing is it will print from a random point each time the EA is loaded and run to the end of the Array.
Any thoughts or help would be much appreciated.
I wasn't able to load the CSV file as well, but any CSV thats 360 x 17 should produce the same results. My CSV are a combination of +/- numbers both integer and doubles. There are no String, Dates or colors. If it makes it easier I can add the CSV file as a txt file later