Data Export Afl

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

// Set the Starting and End Dates

// Make sure these dates are not holidays.


StartDate = ParamDate("Starting Date", "31-12-2007");
EndDate = ParamDate("Start Date", "31-12-2008");
//Find the corresponding Bar Numbers
StartBar = Max(0, LastValue(ValueWhen(DateNum() ==
StartDate, BarIndex(),1)));
EndBar = Min(BarCount - 1, LastValue(ValueWhen(DateNum()
== EndDate, BarIndex(),1)));
Filter = 1; // This allows all required data to be included
// Before running the AFL Make sure that C:\SaveData directory
exists
fh = fopen( "c:\\SaveData\\"+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 = StartBar; i <= EndBar; 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 );
}
// The following lines are redundant but are required for the
Exploration to work.
// These lines will just output the data being written to the file.
SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "Symbol", 77);
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(O, "Open", 6.2);
AddColumn(H, "High", 6.2);
AddColumn(L, "Low", 6.2);
AddColumn(C, "Colse", 6.2);
AddColumn(V, "Volume", 10.0);
//******************* END OF AFL ********************

how to use it...


click this afl...when a chart open > click auto analyser >select all symbols & all
quotations (may be it done by default...is not then you do this ) >click
explore..............>click file-export....name a file and save...

You might also like