To write to file

 

I need help to write second etc. lines of values.

Just what to be added to the code?

Thanks a lot.

  int TotalBars;
    int Handle;
    string Val;
    if(TotalBars<Bars)
      Handle= FileOpen("E.txt",FILE_READ | FILE_WRITE,';');
      if(Handle>0)
      {
        FileWrite(Handle,"  High","   Low","    Open","   Close");
        FileWrite(Handle,High[1], Low[1],Open[1],Close[1]);
      }
  TotalBars=Bars;
 
  int TotalBars;
    int Handle;
    string Val;
    if(TotalBars<Bars)
      Handle= FileOpen("E.txt",FILE_READ | FILE_WRITE,';');
      if(Handle>0)
      {
        FileWrite(Handle,"  High","   Low","    Open","   Close");
        //example
        for(int i = 1; i < Bars; i++){
           FileWrite(Handle,High[i], Low[i],Open[i],Close[i]);
        }
      }
 

Thank you for your great help. It recorded all the history.

 

    double Value = High[0]-High[1];
    int Handle;
      Handle= FileOpen("E.txt",FILE_READ | FILE_WRITE,';');
      if(Handle>0)
      {
        FileWrite(Handle,"  Values List");
        FileWrite(Handle,Value);
       
        }
      }

Question: How can I modify the code that the Values not to be overwritten but

be written in one column? Thank You.

 
double Value = High[0]-High[1];
int Handle;
Handle= FileOpen("E.txt",FILE_READ | FILE_WRITE,';');
if(Handle>0)
   {
   FileSeek(handle, 0, SEEK_END); // add the data to the end of the file
   FileWrite(Handle,"  Values List");
   FileWrite(Handle,Value);
   }
Use FileSeek and Seek to the dn before writing your data to the file.
Reason: