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

RE: [amibroker] How do I export data from Ami to Excel



PureBytes Links

Trading Reference Links

This code works. You can change the titles to suit and remove the OI
field.

 

Copy to an indicator. 

Select symbol to export. 

Use SCAN on selected symbol. 

Find your .csv file in C:\"TickerName".csv

 

/*

Export intraday AND EOD data to CSV files, one file for each stock

In the first line insert the directory you want to save them to, make
sure the directory exists

Select your charts to export with the "Apply to" filter in AA window (or
just pick "current symbol")

Select the timeframe period you want to save as using the AA "Settings"

Press Scan button

by Graham Kavanagh 05 Feb 2004

Removed intraday fields for Daily databases. Terry 6/4/2005

Added OI field. Terry 3/30/2006

*/

 

fh = fopen( "c:\\"+Name()+".csv", "w");

if( fh )

{

    fputs( "Ticker,Date,Open,High,Low,Close,Volume,OI \n", fh );

    y = Year();

    m = Month();

    d = Day();

    r = Hour();

    e = Minute();

    n = Second();

 

    for( ii = 0; ii < BarCount; ii++ )

    {

        if (C[ii] > 0 OR V[ii] > 0 OR OI[ii] > 0)

        {

            fputs( Name() + "," , fh );

            ds = StrFormat("%02.0f-%02.0f-%02.0f,",

            y[ ii ], m[ ii ], d[ ii ] );

            fputs( ds, fh );

            /*

            ts = StrFormat("%02.0f:%02.0f:%02.0f,",

            r[ ii ],e[ ii ],n[ ii ] );

            fputs( ts, fh );

            */

            qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f,%.0f\n",

            O[ ii ],H[ ii ],L[ ii ],C[ ii ],V[ ii ], OI[ ii ] );

            fputs( qs, fh );

        }

    }

 

    fclose( fh );

}

 

Buy = 0;

 

--

Terry

 

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Tanmay Purohit
Sent: Wednesday, July 19, 2006 05:08
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] How do I export data from Ami to Excel

 

Hello,

I want to export OHLC data (Dly quotes) from amibroker to an excel

spreadsheet. My required format in excel is "Scrip Name, Open, High,

Low, Close, Volume". Pls tell me if there is any way of doing it.

Regards,

Tanmay.