Hello,
I would like to extract a short period of tick data, i.e. two days, from a big tick database of circa 4 millions bar
I tried in two ways but failed both:
-
Deleting the not needed bars in the Quotations Editor fails because AB crashes in doing that. Maybe the deleting of millions of bars is considered “not normal”
-
Exporting the data in the desidered period of time and import again as a new symbol. It usually works with the following code but I am not able to manage the timestamp of tick data that cointains microseconds like 12.45.47.844.003
Of course exporting/re-importing is not needed at all, it’s just an idea I had to have a new symbol with a manageable number of bars
Symbol = Name();
fmkdir( "C:\\DataCompressed" );
fh = fopen( "C:\\DataCompressed\\DataCompressed_" + Symbol + "_" + Interval( 2 ) + ".csv", "w" );
if( fh )
{
fputs( "Symbol,Date,Time,Open,High,Low,Close,OpenInt,Volume,Aux1,Aux2\n", fh );
dn = DateNum();
tn = TimeNum();
startdata = ParamDate( "Data start", "31/05/2017" );
enddata = ParamDate( "Data end", "01/06/2017" );
checkdata = DateNum() >= startdata AND DateNum() <= enddata ;
exportedbars = 0 ;
for( i = 0; i < BarCount; i++ )
{
if( checkdata[i] )
{
Line = Symbol/* + "_" + Interval( 2 ) */ +
StrFormat( ",%06.0f,%06.6f,%g,%g,%g,%g,%g,%g,%g,%g\n",
dn[ i ] % 1000000,
tn[ i ],
Open[ i ],
High[ i ],
Low[ i ],
Close[ i ],
OpenInt[ i ],
Volume[ i ] ,
Aux1[ i ] ,
Aux2[ i ] );
fputs( Line, fh );
exportedbars++ ;
}
}
fclose( fh );
}
Buy = Sell = 0; // for scan
Filter = Status( "lastbarinrange" );
AddTextColumn( "Export done " + NumToStr(exportedbars,1.0) + "bars", "Status",1.2,colorBlack,colorDefault,200 );
AddTextColumn( Interval( 2 ), "Timeframe",1.2,colorBlack,colorDefault,200 );
Any idea of how to manage microsecond timestamp in exporting data?
Any other idea about how to have a reduced copy of the symbol with the data just in a short period of time? I need to reduce the number of bars because I don’t like to work with millions tick bars loaded in memory for some months history when I need to work just in one or two days in the middle of the data period
thanks in advance