Page 1 of 1

Export .csv file after backtest.

Posted: Thu Sep 02, 2021 7:16 pm
by ffsss
Is it possible to export a .csv file after a backtest? For example, if I create a counter for the number of operations that adds +1 each time an order is opened, at the end of the backtest I would create a .csv that would contain the value of the total number of open operations in that backtest.

Re: Export .csv file after backtest.

Posted: Thu Sep 02, 2021 8:16 pm
by Csj179t
ffsss wrote: Thu Sep 02, 2021 7:16 pm Is it possible to export a .csv file after a backtest? For example, if I create a counter for the number of operations that adds +1 each time an order is opened, at the end of the backtest I would create a .csv that would contain the value of the total number of open operations in that backtest.

Hi ffsss,

That EA code below does similar. To check csv after test, go to \tester\files folder.

Code: Select all

double count13 = 0;
double count15 = 0;

void OnTick()
  {
  
if(Hour() == 13) count13 += 1;
if(Hour() == 15) count15 += 1;

  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double OnTester()
  {
  
int handle;
handle=FileOpen("countTest", FILE_CSV|FILE_WRITE, '\t');
if(handle>0)
{
   FileWrite(handle, "Count13 " + count13,  "Count15 " + count15);
   FileClose(handle);
}

return(0);
  }
//+------------------------------------------------------------------+

Re: Export .csv file after backtest.

Posted: Fri Sep 03, 2021 2:46 am
by ffsss
Csj179t wrote: Thu Sep 02, 2021 8:16 pm Hi ffsss,

That EA code below does similar. To check csv after test, go to \tester\files folder.

Code: Select all

double count13 = 0;
double count15 = 0;

void OnTick()
  {
  
if(Hour() == 13) count13 += 1;
if(Hour() == 15) count15 += 1;

  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double OnTester()
  {
  
int handle;
handle=FileOpen("countTest", FILE_CSV|FILE_WRITE, '\t');
if(handle>0)
{
   FileWrite(handle, "Count13 " + count13,  "Count15 " + count15);
   FileClose(handle);
}

return(0);
  }
//+------------------------------------------------------------------+
Thanks!