Just as further clarification : the file IS being written every time as per timer. Just with only zeros...
double tickets[][3] ; //Array
Tickets has no size. If the file doesn't exist in init, do you resize the array? Otherwise you can't assign to it and nothing should be written. Are you using the strict property, why not?tickets[0][2]=open_price; tickets[1][2]=profit_closed; tickets[2][2]=longshort; tickets[3][2]=swap_count; tickets[4][2]=swap;
I also suggest you change from a 2D array to a 1D structure, so the code is self documenting. See the example in FileWriteArray - MQL4 Documentation
Thanks!
Yes - i do resize the array, but didn't do so until after OnInit()! Since my file recovery was done in OnInit() obviousely, i think that issue was that while the data was being writting, it wasn't read. The read instruction was prior to the Array being defined. I have corrected that and now it works. So i guess you were right, ...sort of ;-)
As for the 1D array with self documenting coding: That is indeed a great idea. Hadn't thought of that so maybe for a next time. Come to think of it: as i'm using counters in both dimensions on this one, i guess it will not work for this one.
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
I have use FileWriteArray() succesfully in multiple EAs, but this time it just writes "0"s - or it doesn't write at all, despite the msg: File Write =OK. As i'm using the exact syntax i used in other EAs i'm really puzzled and after a couple of hours i give up.
Can someone take a look and tell what i'm overlooking?
This is the fist time i'm using a variable filename, ie a filename that is based on an input parameter, given at EA start.
Sole purpose of the Array is to write variables that ensure a proper recovery after a crash (power outage etc.)