csv file, new data in a new line....

 

HI together!

I want to write eg the spread in a csv file line by line for different times (eg every 10 min), but cannot set the pointer to the correct line (= the next free line).

It always writes the data into the same line. nevertheless i can read an open the file with notepad or Excel. But I always get only on line.

......

int handle = FileOpen(Log_Filename,FILE_CSV|FILE_READ|FILE_WRITE,';');
   if (handle>=0){
      FileSeek(handle,0,SEEK_END);
      FileWrite(handle, date, time, spread);
   }
   FileClose(handle);

......

So can please anybody tell me, how to do to get the data every (eg 10 min) in a new line ?


Thanks Trungs

 

Please use the </> button to insert your code.


 

Hello you can use 

"\n" 

For new line and you can also use 

FILE_TXT
 
Marco vd Heijden:

Hello you can use 

For new line and you can also use 

Thank you, but can Excel read it afterwards?
 
Eleni Anna Branou:

Please use the </> button to insert your code.


Sorry I did not know this button.

int Statistic() {
   
   double spread      = NormalizeDouble(Ask - Bid, 1);
   
   int handle = FileOpen(Log_Filename,FILE_CSV|FILE_READ|FILE_WRITE,';');
   if (handle>=0){
      FileSeek(handle,0,SEEK_END);
      FileWrite(handle, spread); 
   }
   FileClose(handle);
   
   Log_Time += Log_Interval;
}

Thank you again

 
FileWriteString(fileHandle,fibo_level+"\r\n"+fibo_color+"\r\n"+fibo_line+"\r\n"+fibo_name);  
Reason: