Exporting quotes from amibroker to CSV file

john302928

Well-Known Member
#1
I want to export quotes from amibroker to csv file and I am able to do that. but while exporting to csv, DATE and TIME are in single column.Is there anyway that i can have it in separate colomuns while exporting it to csv file.

I know i can write a macro to split them in excel itself. But I am interested to know if there is a way in afl itself we can take care of this issue.

Any help would be really appreciated
 

LOVEENAJYOTHI

Well-Known Member
#2
I want to export quotes from amibroker to csv file and I am able to do that. but while exporting to csv, DATE and TIME are in single column.Is there anyway that i can have it in separate colomuns while exporting it to csv file.

I know i can write a macro to split them in excel itself. But I am interested to know if there is a way in afl itself we can take care of this issue.

Any help would be really appreciated
Use IMPORT WIZARD and choose-----> "COMMA (,) OR SPACE( )" <------as separator while importing to AmiBroker 1st time and save the format for future imports.
 
Last edited:

mastermind007

Well-Known Member
#3
I want to export quotes from amibroker to csv file and I am able to do that. but while exporting to csv, DATE and TIME are in single column.Is there anyway that i can have it in separate colomuns while exporting it to csv file.

I know i can write a macro to split them in excel itself. But I am interested to know if there is a way in afl itself we can take care of this issue.

Any help would be really appreciated

You will have to do that in a scanner

Code:
xName = Name();
//fh = fopen( "C:\\OHLC\\"+Name()+".csv", "a"); // append
fh = fopen( "C:\\AmiFeeder\\"+Name()+".csv", "w"); // overwrite

if( fh )
{
fputs( "Ticker,Date,Time,Open,High,Low,Close,Volume, OpenInt \n", fh );
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] )
{
y = Year();
m = Month();
d = Day();
hr = Hour();
mi = Minute();
ss = Second();
//tn = TimeNum();

//Traditional approach

fputs( xName + "," , fh );
ds = StrFormat("%04.0f%02.0f%02.0f", y[ i ], m[ i ], d[ i ] );
fputs( ds, fh );

ts = StrFormat(",%02.0f%02.0f00", hr[ i ],mi[ i ]); //ss[i]
fputs( ts, fh );

qs = StrFormat(",%.2f,%.2f,%.2f,%.2f,%.0f,%.0f\n"
, O[ i ],H[ i ],L[ i ],C[ i ],V[ i ], OpenInt[i] );
fputs( qs, fh );
}
}
fclose( fh );
}
 

john302928

Well-Known Member
#4
Thank you @ Mastermind.
 
Last edited:

copypasteaee

Humbled by Markets
#5
better zip ur database folder and keep that as backup, csv creation and upload again some times create issues and we lose precious data.
 

Similar threads