Can't create data file

 

Hi, 

I am running MT4 on Windows 7 Home Preminum and am unable to create a file based on the following script:

//+------------------------------------------------------------------+
//|                                            SatCustomFunction.mq4 |
//|                                                           Gilkar |
//|                                        https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Gilkar"
#property link      "https://www.metaquotes.net/"

int         handle;
double      PriceChange=0;


int init()
{
Comment("SatFileTest started");
handle = FileOpen("lar_data.txt",FILE_CSV|FILE_READ|FILE_WRITE,',');
if(handle<1) Print("File lar_data.txt not found, the last error is ", GetLastError());

// FileSeek(handle, 0, SEEK_END);
for(int i=0;i<15;i++)
   {
   PriceChange = Close[i] - Open[i];
   FileWrite(handle,i,Open[i],Close[i],PriceChange);
   }
FileClose(handle);
Comment("SatFileTest completed");
}

int deinit()
{
}

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
{

  
return(0);
}
//+------------------------------------------------------------------+

 

I have set permissions on the entire MT4 directory to full control for all users, so I don't believe that this is the issue.

Any assistance would be approciated.

Lars. 

 
larzand:

Hi, 

I am running MT4 on Windows 7 Home Preminum and am unable to create a file based on the following script:

<SNIP>

I have set permissions on the entire MT4 directory to full control for all users, so I don't believe that this is the issue.

Any assistance would be approciated.

Lars. 

Please edit your post . . . 


Please use this to post code . . . it makes it easier to read.

 
larzand:

Hi, 

I am running MT4 on Windows 7 Home Preminum and am unable to create a file based on the following script:


I have set permissions on the entire MT4 directory to full control for all users, so I don't believe that this is the issue.

Any assistance would be approciated.

Lars. 

Works just fine for me,  it's most probably a UAC issue,  the easiest solution is to uninstall MT4 and reinstall in a folder other than Program Files,  for example:  C;\MT4Installs\