
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
There was no file attached . . .
Have you confirmed that the file you are trying to read from actually exists ? please look in the correct folder and check . . . one other thing, why do you have a function called filewriting() to READ from a file ?
Dear RaptorUK,
Yes, I can confirm that the DAT file is in the folder MQL4/files. In fact, I have informed that I put a condition whether the fileopen succeeds and it succeeds most of the time (90%) and 10% fails to open and generate a 5004 error code.
The filewriting() function is called when a fileopen fails. Then, the funcition filewriting would try to create a file (open for write) and at the end of the function, do the fileclose.
I have attached the file from the Print() statement out of MQL4\logs folder. I clicked the button "Choose File" and I could see that the file name was displayed.
Warm regards,
Raisingfire
Dear RaptorUK,
Yes, I can confirm that the DAT file is in the folder MQL4/files. In fact, I have informed that I put a condition whether the fileopen succeeds and it succeeds most of the time (90%) and 10% fails to open and generate a 5004 error code.
The filewriting() function is called when a fileopen fails. Then, the funcition filewriting would try to create a file (open for write) and at the end of the function, do the fileclose.
I have attached the file from the Print() statement out of MQL4\logs folder. I clicked the button "Choose File" and I could see that the file name was displayed.
Warm regards,
Raisingfire
Where do these files come from ? what writes them ?
Dear RaptorUK,
All the DAT files are meant to be a temporary files to hold initial values of certain indicators every time we open a position. We created and used them in our programs.
We use standard function to open the file for writing:
fhandle=FileOpen(mf, FILE_BIN|FILE_WRITE);
Standard array writing to the temp files (DAT) :
FileWriteArray(fhandle, mpara, 0, maxori); // where mpara is the array, Maxori is the maximum size of the array
Standard file closing function:
FileClose(fhandle);
Thank you for your help.
Regards,
Raisingfire
Dear RaptorUK,
All the DAT files are meant to be a temporary files to hold initial values of certain indicators every time we open a position. We created and used them in our programs.
We use standard function to open the file for writing:
fhandle=FileOpen(mf, FILE_BIN|FILE_WRITE);
Standard array writing to the temp files (DAT) :
FileWriteArray(fhandle, mpara, 0, maxori); // where mpara is the array, Maxori is the maximum size of the array
Standard file closing function:
FileClose(fhandle);
OK, but you didn't actually answer my question . . . are they written by the same EA that is trying to read them ? or a different EA, Script or Indicator ?
OK, but you didn't actually answer my question . . . are they written by the same EA that is trying to read them ? or a different EA, Script or Indicator ?
The Filewriting function is in all in the same EA. Everytime, we issue a "FILEOPEN", we always follow it by "FILECLOSE" after we do certain task with it. So, I don't think there is a problem with locked file that is being tried to be opened.
Long time ago, we had that kind of problem where a locked file was being tried to be read. And MT4 automatically reported it in its log file. So, after 1 or 2 days, the Logs and history folders became huge in size (hundreds of Mbytes), full of those reports. Then, we issue a FILECLOSE everytime we do FILEOPEN. The problem was solved and the logs and history folders never got huge anymore. Now, the log and history folders combined contains only less than 100 Kbytes (despite the error code 5004 that keeps popping up).
Thanks,
Raisingfire
The Filewriting function is in all in the same EA. Everytime, we issue a "FILEOPEN", we always follow it by "FILECLOSE" after we do certain task with it. So, I don't think there is a problem with locked file that is being tried to be opened.
Long time ago, we had that kind of problem where a locked file was being tried to be read. And MT4 automatically reported it in its log file. So, after 1 or 2 days, the Logs and history folders became huge in size (hundreds of Mbytes), full of those reports. Then, we issue a FILECLOSE everytime we do FILEOPEN. The problem was solved and the logs and history folders never got huge anymore. Now, the log and history folders combined contains only less than 100 Kbytes (despite the error code 5004 that keeps popping up).
OK thanks for the information. I'm out of ideas . . . all I can suggest now is to create a test EA that reproduces the issue that you can post here and send to MetaQuotes as part of a Service Desk ticket and ask them to investigate.
Dear RaptorUK,
Thank you for all you help and info anyway. I will try to do what you told me.
Once again, Thank you.
Regards,
Dear RaptorUK,
Thank you for all you help and info anyway. I will try to do what you told me.
Once again, Thank you.
Regards,
Is there a solution to error 5004 please? I am getting the same error message trying to write to a file.
I am on build 765.
Your help is greatly appreciated.