Hello,
1 year ago I used the code from knowledge database to export minute data to csv file (see below). it used to work well on EUR.USD for instance. The 1 minutes database is generated and populated with IB pulgin.
Now it doesn’t work anymore. AFL never stops and the file is not created. 2 strange points:
- If I run the same AFL on the EOD database it works.
- If I run just an AFL creating and closing a file without collecting data it doesn’t work (see code below).
Any idea ?
Thank you
- Limited code just creating a file
fh = fopen( "DataFor"+Name()+".csv", "w" );
if( fh )
{
fputs("Symbol,Date,Time,Open,High,Low,Close,OpenInt,Volume\n", fh );
fclose( fh ); // MUST CLOSE FILES !!!!
}
Buy=Sell=0; // for scan
Filter = Status("lastbarinrange");
AddTextColumn("Export done", "Status");
- Complete expport code as per knowledge database
n = Name();
dn = DateNum();
tn = TimeNum();
// until 2016 March 11th 6:59am
exportFilter = ( n == "Symbol 1" AND dn <= 1160311 AND tn <= 65900 ) OR
( n == "Symbol 2" AND dn >= 1160311 AND tn > 65900 );
fh = fopen( "DataFor" + Name() + ".csv", "w" );
if( fh )
{
fputs( "Symbol,Date,Time,Open,High,Low,Close,OpenInt,Volume\\n", fh );
for( i = 0; i < BarCount; i++ )
{
if( exportFilter[ i ] )
{
Line = Name() +
StrFormat( ",%06.0f,%06.0f,%g,%g,%g,%g,%g,%g\\n",
dn[ i ] % 1000000,
tn[ i ],
Open[ i ],
High[ i ],
Low[ i ],
Close[ i ],
OpenInt[ i ],
Volume[ i ] );
fputs( Line, fh );
}
}
fclose( fh );
}
Buy = Sell = 0; // for scan
Filter = Status( "lastbarinrange" );
AddTextColumn( "Export done", "Status" );