Here is the code.

/*** START ***/

// Change "output_folder" and "output_file" as needed (first two lines). No 
other changes are reequired.

// 1) Execution: AA - ApplyTo (set "filters") - Date Range (doesn't work) - Scan
// 2) If the directory doesn't exist it WILL be created automatically
// 3) Hitting "verify" or "apply" buttons exports only the active symbol. Use 
"scan" to export a watch list
// 4) Ref: http://www.amibroker.com/library/detail.php?id=327
//    Ref: http://finance.groups.yahoo.com/group/amibroker/message/104595

output_folder = "C:\\Test";
output_file   = "Test.csv";

if ( Status("stocknum") == 0 )
{
fmkdir( output_folder ); // if the directory doesn't exists it will be 
automatically created
fopen( output_folder + "\\" + output_file, "w"); // if the file already exists 
all data will be w=overwritten
}

fh = fopen( output_folder + "\\" + output_file, "a"); // a=append needed to get 
all tickers from watch list
if (fh)
{
  t = Name();
  f = FullName();
//y = Year()%100; // 2-digit year
  y = Year();     // 4-digit year
  m = Month();
  d = Day();
for( i = 0; i < BarCount; i++ ) // loop with all bars included
// for( i = BarCount - 2; i < BarCount; i++ ) // loop with only the last two 
bars included
  {
  fputs( t + "," , fh );
  fputs( f + "," , fh );
  ds = StrFormat( "%02.0f/%02.0f/%02.0f,", m[i], d[i], y[i] ); // date string
//ds = StrFormat( "%02d/%02d/%02d,", y[i], m[i], d[i] ); // C++ "d" integer 
specifier won't work
  fputs( ds, fh );
  qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f,%.0f\n", O[i], H[i], L[i], C[i], 
V[i], OI[i] ); // quote string
  fputs( qs, fh );
  }
fclose( fh );
}
Buy = 0; // link to "scan" button

/***************
"One time switch" is used; it opens the file in overwrite mode once and then 
runs in append mode 
rest of the time.

fh = file handle
ds = date string
qs = quote string
***************/

/*** END ***/

--- In [email protected], "doggy2050" <[EMAIL PROTECTED]> wrote:
>
> Dear Members,
> 
> I want to export EoD data in the following format :
> 
> <TICKER> <FULL NAME> <DATE(MM/DD/YYYY)> <OPEN> <HIGH> <LOW> <CLOSE> 
> <VOLUME> <OPENINTEREST>
> 
> could anyone help me in this regard.....
> 
> thanx
>


Reply via email to