Export Script

Posted By: killerkhan

Export Script - 07/02/14 06:15

Hello everyone, trying to see if anyone can help me with some coding. I am using the download script from the manual

http://www.zorro-trader.com/manual/en/export.htm

Code:
function run()
{
  BarPeriod = 1440;
  StartDate = 2008;
  EndDate = 2012;
  LookBack = 0;

  char line[100];
  sprintf(line,
    "%02i/%02i/%02i %02i:%02i, %.5f, %.5f, %.5f, %.5f\n",
    day(),month(),year()%100,hour(),minute(),
    priceOpen(),priceHigh(),priceLow(),priceClose());
  if(is(INITRUN))
    file_delete("Data\\export.csv");
  else
    file_append("Data\\export.csv",line);
}



this code exports the data as follows...

Date Time, Open, High, Low, Close

and saves the file as export.csv

here is what I want to do.
export the data so there is a comma between the Date and Time and also if possible to export the Volume as well. so end data will look like

Date, Time, Open, High, Low, Close, Volume

and want to save the file as the Symbol and BarPeriod used for export. For Example, if symbol is EUR/USD and BarPeriod is 60 I want the exported file to be called EURUSD_60.csv

is that possible? thanks in advance

KK
Posted By: jcl

Re: Export Script - 07/02/14 06:44

Forex has no volume. But for the comma, just replace the first blank in the format string with a comma.

The file name can be generated from the asset name and bar period in a very similar way, with sprintf, like this

sprintf(...,"%s_%i.csv",Asset,BarPeriod);

"%s" in a format string inserts a string.
Posted By: killerkhan

Re: Export Script - 08/16/14 04:41

jcl, how often do I have to update the Assets.dat and AssetsFix.dta files? once a day? once a week? once a month? thanks,

kk
Posted By: jcl

Re: Export Script - 08/18/14 18:01

That is up to you - we do update them about every two months, on any new release.
© 2024 lite-C Forums