FileOpen error 5004

 

I have this news indicator I am calling from an EA, but occasionally it throws an error 5004 cant open xml file, yet the xml file does indeed exist. It will go days working and then all of a sudden something happens and it throws this error. Anything in this indicator code that may be a culprit?

Files:
ffcal.mq4  56 kb
 

Is it possible the file is open by you or by another chart/indicator ? Only one process can open a file for write at one time.

I checked and all file handles are closed. unless there is a bug in mt4 or something. Also are you sure it is the local xml file ? Or could it be the one being downloaded ? Does the problem go away on its own or do you have to do something ?

local file name. 

return (Month() + "-" + Day() + "-" + Year() + "-" + Symbol() + Period() + "-" + "FFCal.xml"); 

Cheers Mary 

 
Thank you for the reply, yes the error does seem to come and go.
 

Actually, I noticed the log file isn't getting closed on deinit()

 put this down right before the return(0)

  if (logHandle != -1)

      FileClose(logHandle);

return(0); 

Reason: