Home » Amibroker

Backup you Amibroker EOD Database in CSV Format

25 November 2009 1,169 views One Comment

Backup your Amibroker Database

I was trying to search an option which will export the data from AmiBroker to a folder where the data will be stored in seperate csv sheets. Here is a simple trick to export your Amibroker EOD Database to CSV Format. For eg. Nifty will be stored in a sheet where the data will be there from the date specified in the Automatic Analysis window to the date specified in Automatic Analysis window
AFL Code for Exporting to CSV
fh = fopen( “c:\\AmiBackup\\”+Name()+”.csv”, “w”);
if( fh )
{
fputs( “Ticker,Date,Open,High,Low,Close,Volume \n”, fh );
y = Year();
m = Month();
d = Day();
//r = Hour();
//e = Minute();
//n = Second();

for( i = 0; i < BarCount; i++ )
{
fputs( Name() + “,” , fh );
ds = StrFormat(“%02.0f-%02.0f-%02.0f,”,
y[ i ], m[ i ], d[ i ] );
fputs( ds, fh );

//ts = StrFormat(“%02.0f:%02.0f:%02.0f,”,
//r[ i ],e[ i ],n[ i ] );
//fputs( ts, fh );

qs = StrFormat(“%.4f,%.4f,%.4f,%.4f,%.0f\n”,
O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] );
fputs( qs, fh );
}

fclose( fh );
}

Buy = 0;
Steps to Backup your Data
1)Save the Export to CSV AFL Code to C:\Program Files\AmiBroker\Formulas\Custom path
2)Create a Folder Name “Amibackup” in C:\ Drive
3)Open Amibroker ->Analysis-> Automatic Analysis
4)Select All Symbols option from the Apply to coloumn and All Quotatios from the Range Column
you can also select specific Stocks by selecting the suitable options from the Apply to Column
5)Run SCAN
6)Amibroker Database converts to individual .csv file
Download the AFL code
Here the limitation is that you cannot specifiy the range of Date. By Default it will download from starting date to
ending date

Random Posts

  • Dropout Game in Nifty
    Nifty CMP : 2714   Chart show above is a 3 month hourly Charts for Nifty with 200 period SMA As per 200 period SMA. Nifty is likely a buy only above 200houly SMA which  comes exactly near 2800 as of now. Till then it is likely goi...
  • DOW-GOLD Ratio touched new low
    The Dow/Gold Ratio chart shows the ratio of the price of the Dow to the price of gold. Another way to look at it is the number of ounces of gold it takes to buy one share of the Dow. For example, with the Dow at 10,000 and gold at 500, it requires 20...
  • Fibonnaci Value from Nifty Hourly charts
    Fibonnaci Values(Approx) taken between the recent high and lows 3113 and 2721 repectively   38.2% - 2884   50% - 2933   61.8% - 2983   Let see how far the bounce back extends     Source: www.marketcalls.in...
  • Still the tussle with the GANN FAN Charts are not over
    Still the tussle with the GANN FAN lines are not yet over. Bears trying to close below the bearish side of the trend line Check out the GANN FAN Charts for Nifty and the Zoomed GANN Charts. Nifty today also closed below the bearish side of the trend ...
  • Selling Pressure Mounted in Nifty
    Just trying like Genius Jaggu   RSI - 2  : 97.82(Highly Oversold) Trin : 0.86 (Mixed Nature) 5 EMA Support : 2950 50 SMA Resistance : 3051   Overall : Selling Pressure Mounted at Higher Levels for Tommorow Source: www.marketcalls.in...
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

One Comment »

  • Lokanath said:

    Great code

    thank you

    I cud backup my ami data

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

Optionally add an image (JPEG only)