Amibroker One minute Data export to csv file

#1
Hello experts, Can anybody help me export one minute data from amibroker to csv. I hve a afl which earlier worked very nicely after selecting it on New Analysis window and then click Scan. But for long it stopped working. I am unable figure out the problem. Here is my afl:
Code:
fh = fopen( "c://AmiBackupOnemin//"+Name()+".csv", "w");
if( fh )
{
fputs( "Ticker,Date,Open,High,Low,Close,Volume
", 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;
 

Romeo1998

Well-Known Member
#2
made some small changes, now its working fine :)
in analysis, select required Range of data to be exported and periodicity as 1min :)
good luck :)
Code:
fmkdir( "C:\\AmiBackupOnemin\\" );
fh = fopen( "C:\\AmiBackupOnemin\\"+Name()+".csv", "w");
barsinrange = Status("barinrange");
if( fh )
{
//fputs( "Ticker,Date,Time,Open,High,Low,Close,Volume", fh );
y = Year();
m = Month();
d = Day();
r = Hour();
e = Minute();
n = Second();
for( i = 0; i < BarCount; i++ )
{

if (barsinrange[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;
 
#3
Hello Romeo1998, Thanks for help. But it didnt work really. As with earlier afl I quoted, the same way It just gave literally one minute data for all date : I mean just data from 9:15 to 9:16 for all the dates and hence a very small file of 65 kb instead of a few MBs file loaded wiith 3-4 years of one min data. I am attaching here the file it exported. I tyried to export data from March 2018 to June 2020. One thing I did miss as I didnt know how to set Periodicity of one minute in New Analysis ( I cudn't find any option to do it there).
 

Attachments

#4
Hello Romeo1998, I am jumping the post. But now I stand corrected. It did work and worked Perfectly and so is my older afl. You pointed out very important part of thing: I was not setting Periodicity in New Analysis setting. When I set it, it worked perfectly. Thanks a lot, Sir for your kind help. Thanks Traderji too for giving us chance to get hel and working as a great forum.
 

Similar threads