[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Exporting data to ASCII format question



PureBytes Links

Trading Reference Links

Here is a version of Graham's code with two digit years:

y = Year()%100;

/*****
1) Execution: AA - ApplyTo (set "filters") - Date Range (doesn't work) - Scan
2) if the output directory (folder) doesn't exist it will NOT be created.
3) Date format: mm/dd/yy.
4) References
   - Graham Kavanagh's code: http://www.amibroker.com/library/detail.php?id=327&hilite=fputs
****/

output_folder = "c:\\test\\";

fh = fopen(output_folder + Name() + ".csv", "w");

if (fh)
{
  fputs( "Date,Open,High,Low,Close,Volume,OpenInt\n\n", fh );
    y = Year()%100; // two digit year
    m = Month();
    d = Day();
  for( i = 0; i < BarCount; i++ )
    {
    ds = StrFormat("%02.0f/%02.0f/%02.0f, ", m[i], d[i], y[i] );
    fputs( ds, fh );
    qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f, %.0f\n", O[i], H[i], L[i], C[i], V[i], OI[i] );
    fputs( qs, fh );
    }
  fclose( fh );
}
Buy = 0;

/*** END ***/

--- In amibroker@xxxxxxxxxxxxxxx, "Tony Lei" <yiupang91@xxx> wrote:
>
> Thanks for the help.  I was able to find a code that Graham wrote a while
> back that meets my criteria.




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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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