Download MetaTrader 5
To add comments, please log in or register
Join MQL5 Cloud Network affiliate program and make money!
mark101
82
mark101 2015.11.30 15:38 
...so that I can use that to name a csv-file which the EA produces. Is there already a built-in variable for that?
Ali Akcaagac
169
Ali Akcaagac 2015.11.30 15:48  
datetime timeval = TimeLocal();
string filename = "file-" + timeval + ".csv";
...

... This will return a string similar to "file-142414233.csv", where this crippled number shows the seconds since 1st of january 1970 until now. You can modify the datetime value to show more representative things like e.g. "file-20151130123359.csv" if you wish.

Carl Schreiber
5927
Carl Schreiber 2015.11.30 16:13  
datetime start=0,end=0;
...
int start() {
   if (start==0) start = TimeCurrent();
   end = TimeCurrent();
}
...
double OnTester() {
   string FrTo = TimeToString(start)+"-"+TimeToString(end); // no seconds: 2015.08.12 08:12
   int fnd = StringReplace(FrTo,":",""); //get rid of :
}
mark101
82
mark101 2015.11.30 16:23  
...
mark101
82
mark101 2015.11.30 16:28  
gooly:

Thanks, gooly. I guess there is no way to have the end date right from the start because the csv-file is written on the fly (output at each bar) and not at the end of the test?
Carl Schreiber
5927
Carl Schreiber 2015.11.30 17:35  
Alexnice:
Thanks, gooly. I guess there is no way to have the end date right from the start because the csv-file is written on the fly (output at each bar) and not at the end of the test?

1) You can enter the dates as parameters of the EA,

2) Write a tmp-file and rename it at the end

mark101
82
mark101 2015.11.30 18:21  
Nr.2 works for me, thanks a lot.
/
To add comments, please log in or register