Below is AFL that exports data to C:\Test\Ms_eod.csv in the old MetaStock 
format:

ticker, D, date, open, high, low, close, vol, open int

The date format is: yyyymmdd. How to make  it: yymmdd ? It probably requires 
modifying "date string" line:

  ds = StrFormat("%02.0f%02.0f%02.0f,", y[i], m[i], d[i] ); // date string

/***************
Export eod data in Metastock format (TD_yymmdd_OHLCVI) to C:\Test\Ms_eod.csv

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" and "apply" buttons exports only the active symbol. Use 
"scan" to export a watch list
***************/

folder = "C:\\Test";
fmkdir( folder ); // this automatically creates the directory

fh = fopen( folder + "\\" + "Ms_eod.csv", "a"); // data from all symbols is 
exported to a single file; "a" = "append"

if (fh)
{
  t = Name();
  p = "D";
  y = Year();
  m = Month();
  d = Day();
for( i = 0; i < BarCount; i++ ) // loop
  {
  fputs( t + "," , fh );
  fputs( p + "," , fh );
  ds = StrFormat("%02.0f%02.0f%02.0f,", y[i], m[i], d[i] ); // date string
  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

/**** END ****/





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to