How to put the start & end date of a backtest into a variable?

 
...so that I can use that to name a csv-file which the EA produces. Is there already a built-in variable for that?
 
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.

 
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 :
}
 
...
 
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?
 
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

 
Nr.2 works for me, thanks a lot.
Reason: