Hi all
I would like to export some data as recommended by JCL here.
The export of 1min 1 year 1 forex pair OHLC data takes 2 to 3 minutes depending which from the below codes I use.
This is the time needed to write the CSV file with some 358636 rows (1 min data of EURUSD for 2013) and 6 columns.
This AFTER I turned off the Windows Defender on Windows 10 (otherwise it takes about an hour).

Can I optimise the speed of print(TO_CSV,...) ?
I am asking since the same task takes ZHistoryEditor about 8 sec.
Also the Multicharts are significantly faster in the CSV export.
Thx for help

Code 1 (2 mins):
Code:
function run()
{
  BarPeriod = 1;		  
  StartDate = 2013;
  EndDate = 2013;		
  LookBack = 0;

  print(TO_CSV,"%02i/%02i/%02i %02i:%02i, %.5f, %.5f, %.5f, %.5fn",
		  day(),month(),year(),hour(),minute(),
		  priceOpen(),priceHigh(),priceLow(),priceClose());
}



Code 2 (3 mins):
Code:
function run()
{
  BarPeriod = 1;		
  StartDate = 2013;
  EndDate = 2013;		
  LookBack = 0;

  string line = strf(
    "%02i/%02i/%02i %02i:%02i, %.5f, %.5f, %.5f, %.5fn",
    day(),month(),year()%100,hour(),minute(),
    priceOpen(),priceHigh(),priceLow(),priceClose());
  
  if(is(INITRUN))
  file_delete("Dataexport.csv");
  else
  file_append("Dataexport.csv",line);
}




Last edited by Sinuhet; 01/05/19 00:38.