FileOpen: add data to an existing file !!

 
The reference ( "MQL4: FileOpen" ) of FileOpen says:
If there is a need to add data to an existing file, it must be opened using combination of FILE_READ | FILE_WRITE.
So I use
hfile=FileOpen(filename,FILE_READ|FILE_WRITE,"\t");
to add data to the existing file.

But, if I re-launch my script, the previous data in the file (BarS1.txt) are lost.
What's wrong in my script?
How to keep previous data if I re-launch the script?
Do you have an idea?

Thanks.

CntBarOut.mq4 :

//------------------------------------------------------------------------------
int i,m,n,r,s,u,v;
double indA;
int PeriodMM=11;
int ModeMM=MODE_LWMA;
int PriceMM=PRICE_WEIGHTED;
//------------------------------------------------------------------------------
//  SCRIPT start function                                                      |
//------------------------------------------------------------------------------
int start() {
  int CntBars=Bars;
	int Mode,Price,CntBO=0,sumVolat=0,hfile;
	string filename="BarS1.txt";
	double delta=0;
	FileDelete(filename);
	hfile=FileOpen(filename,FILE_READ|FILE_WRITE,"\t");
	if(hfile<0) {
		Print(filename," OPEN Error: ",GetLastError());
		return(0);
	}
	FileWrite(hfile,"Paire","Mode","Price","BarOut[%]",
	"DisM[Pi]","All","VolatM[Pi]");
	for (i=0;i<CntBars;i++) {sumVolat+=High[i]-Low[i];}
	//
	for (Mode=0;Mode<4;Mode++) {
		for (Price=0;Price<7;Price++) {
			for (i=0;i<CntBars;i++) {
				indA=iMA(NULL,0,PeriodMM,0,Mode,Price,i);
				if (High[i]<indA) {CntBO++;delta+=(indA-High[i])/Point;}
				if (indA<Low[i]) {CntBO++; delta+= (Low[i]-indA)/Point;}
			}
			FileWrite(hfile,Symbol(),Mode,Price,100*CntBO/CntBars,
			delta/CntBO,delta/CntBars,sumVolat/CntBars);
			CntBO=0;delta=0;
		}
	}
  FileClose(hfile);
	return(0);
}
//------------------------------------------------------------------------------


 
You need move file position to the end of file after file opening. Use FileSeek function ("MQL4: FileSeek")
FileSeek(handle, 0, SEEK_END);
 
There is this line: FileDelete(filename);
Everytime you relaunch your EA, this line deletes your file.