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
0 comments
Post a Comment