Spread recording fail

 

Hi

I use this indicator Spread_Recorder.mq4

http://www.forexfactory.com/showthread.php?t=195290


It has worked perfect with different brokers, but i just opened a new account with another broker and id stops to work.?


I says: invalid filename for FileOpen function

And i allso have created a folder in files/ that is named correctly "Spread_Recording"


Anyone know why?

Files:
 
pontuso:

Hi

Anyone know why?

Sounds like a UAC issue . . .
 

It works with the same terminal but with DEMO account?


Can my broker block this FileOpen function?

 
pontuso:

It works with the same terminal but with DEMO account?


Can my broker block this FileOpen function?

Search for UAC on this forum and read . . .
 

Ok so what i understand if i turn off the UAC controls in windows it should work.

But when i do that, i will still get the same error.


And the MT4 is also installed directly in to C:/


Anything else you think it could be?

 
pontuso:

Ok so what i understand if i turn off the UAC controls in windows it should work.

But when i do that, i will still get the same error.


And the MT4 is also installed directly in to C:/


Anything else you think it could be?

Please copy and paste the error lines from the log file . . . not from the experts tab.
 
11:12:27 Spread_Recorder EURUSD..,H1: loaded successfully
11:12:29 Spread_Recorder: invalid filename for FileOpen function
11:12:29 Spread_Recorder: invalid filename for FileOpen function
11:12:29 Spread_Recorder EURUSD..,H1: initialized
11:12:48 Spread_Recorder: invalid filename for FileOpen function
11:12:48 Spread_Recorder: invalid filename for FileOpen function
11:12:49 Spread_Recorder: invalid filename for FileOpen function
11:12:50 Spread_Recorder EURUSD..,H1: deinitialized
11:12:50 Spread_Recorder EURUSD..,H1: uninit reason 1
11:12:50 Spread_Recorder EURUSD..,H1: removed
 
pontuso:
11:12:27 Spread_Recorder EURUSD..,H1: loaded successfully
11:12:29 Spread_Recorder: invalid filename for FileOpen function
11:12:29 Spread_Recorder: invalid filename for FileOpen function
11:12:29 Spread_Recorder EURUSD..,H1: initialized
11:12:48 Spread_Recorder: invalid filename for FileOpen function
11:12:48 Spread_Recorder: invalid filename for FileOpen function
11:12:49 Spread_Recorder: invalid filename for FileOpen function
11:12:50 Spread_Recorder EURUSD..,H1: deinitialized
11:12:50 Spread_Recorder EURUSD..,H1: uninit reason 1
11:12:50 Spread_Recorder EURUSD..,H1: removed

Users wonder why I keep going on about checking function return values and reporting errors . . . What filename is invalid ? if the original coder had checked the return value, determined the error and printed the filename we would have a better idea of what was wrong . . .


Please make this addition or try the attached version, marked // added by RaptorUK

void WriteToLogFile(string input)
{
   string filename = "Spread_Recording/"+Symbol()+"-Spread_Recorder-"+Day()+"-"+Month()+"-"+Year()+".log";
   input = TimeHour(TimeCurrent())+":"+TimeMinute(TimeCurrent())+":"+TimeSeconds(TimeCurrent())+" - "+input;
   int handle = FileOpen(filename,FILE_READ|FILE_WRITE);
   if (handle>1)
   {
      FileSeek(handle, 0, SEEK_END); // go to end of file
      FileWrite(handle, input);
      FileClose(handle);
   }
   
   else     //  added by RaptorUK
      {
      Print("FileOpen failed, trying to open: ", filename, " error# ", GetLastError());
      
      }
Files:
 
By the way, if t=you have the file open in another application MT4 may fail trying to open it . . .
 

Ok thanks for the correction!

I get this error. ERR_WRONG_FILE_NAME (4101)

12:38:50 Spread_Recordera_1_: invalid filename for FileOpen function

12:38:50 Spread_Recordera_1_ EURUSD..,H1: FileOpen failed, trying to open: Spread_Recording/EURUSD..-Spread_Recorder-8-1-2014.log error# 4101


I have seen that the demo account symbol name is "EURUSD.m" and the real account symbol is named "EURUSD.." can this might cause the error?

 
RaptorUK:
By the way, if t=you have the file open in another application MT4 may fail trying to open it . . .


And im not having the file open in another application, what i can see.