Download MetaTrader 5

Simple program write to file - page 2

To add comments, please log in or register
MQL5.community allows users to store their source codes in MQL5 Storage. Try it!
MetaQuotes Software Corp.
Moderator
181078
MetaQuotes Software Corp. 2010.01.08 12:32  
edas:

Here is line from expert:

But expert writes line by line from beginning of existing file. Perhaps it is necessary to tell expert to write to end of file with cycle statement, but I don't understand how write such cycle.

Edward

To add data to the end of CSV file use FileSeek.

fx-analysis
194
fx-analysis 2010.01.10 22:23  
Thanks Quantum, it helped :)
meikel
364
meikel 2010.01.10 22:54  
int FileHandle=FileOpen(FileName, FILE_BIN|FILE_WRITE|FILE_READ);
  if(FileHandle>0)
     {
      FileSeek(FileHandle, 0, SEEK_END);
      FileWrite(FileHandle,Text) ;
      FileClose(FileHandle);
     }
sunyc1982
9
sunyc1982 2014.08.21 06:12  
MetaQuotes:


File handle is not boolean, here is your code that saves Time, Bid, Ask.


Enable experts, and attach it to chart. after the expert deataching your file data1.csv will have contents something like this:

Can you make your ea only record the last 50 ticks?
Simon Gniadkowski
Moderator
18000
Simon Gniadkowski 2014.08.21 19:34  
sunyc1982:

Can you make your ea only record the last 50 ticks?
Why are you asking a question about a 4 year old post ?
12
To add comments, please log in or register