Intraday Quotation Delete

Hello Sir,

This is my first post in this forum thanks to everyone helping to each other’s.

I’m using mixed EOD/intraday database in that I want to Delete Only Intraday database starting From to between the date Range, also I tried in AB Edit> Delete Range option, but it’s Deleting including EOD Database, finally I used Below JavaScript code download from internet its working fine but its time-consuming process to Delete 1 symbol of 20 days (1m) data it will take approximately 7 to 8 minutes to delete intraday Data, so I have more than 250 symbols it’s very time consuming process, anyone help me to speech up the Below JavaScript code or do you have any others suggestions to complete my work.

Thank you
Regards

Veeresh wali

Capture2

Date.prototype.yyyymmddhhmmss = function()
{
     //Modified the code from
     var mm = this.getMonth() + 1; // getMonth() is zero-based
     var dd = this.getDate();
     var hh = this.getHours();
     var mi = this.getMinutes();
     var ss = this.getSeconds();
     var yyyymmdd = [ this.getFullYear(), ( mm > 9 ? '' : '0' ) + mm, (dd > 9 ? '' : '0') + dd ].join('');
     var hhmmss = [ ( hh > 9 ? '' : '0' ) + hh, ( mi > 9 ? '' : '0' ) + mi, ( ss > 9 ? '' : '0' ) + ss, ].join('');
     return yyyymmdd + '' + hhmmss;
};

filespec = "C:/AmiData1m/WatchLists/Delete Test.tls";
DataDir = "C:\\AmiData1m"; 

var fso, watchlist, s, ForReading;
ForReading = 1, ForWriting = 2, s = "";
fso = new ActiveXObject( "Scripting.FileSystemObject" );
watchlist = fso.OpenTextFile( filespec, ForReading, false );

var oAB = new ActiveXObject( "Broker.Application" );
oAB.LoadDatabase( DataDir );
var oStocks = oAB.Stocks;
var Qty = oStocks.Count;

var DeleteFrom = new Date( "September 01, 2021 09:15:00" ).yyyymmddhhmmss(); 
var DeleteTo = new Date( "September 30, 2021 15:29:00" ).yyyymmddhhmmss(); 

file = fso.OpenTextFile( "_remowe_xdays.log", ForWriting, true );
file.WriteLine( "Starting delete quotes from date:" + DeleteFrom );
file.WriteLine( "" );

while( !watchlist.AtEndOfStream )
{
     s = watchlist.ReadLine();
     for( i = 0; i < Qty; i++ )
     {
         oStock = oStocks( i );
         if( s == oStock.Ticker )
         {
             file.Write( i + ". " + oStock.Ticker + "=" );
           
             for ( j = oStock.Quotations.Count - 1; j >= 0; j-- )
             {
                 var tmpDateNum = new Date( oStock.Quotations( j ).Date ).yyyymmddhhmmss();                
                 if( ( tmpDateNum % 1000000 != 0 ) && ( tmpDateNum >= DeleteFrom ) && ( tmpDateNum <= DeleteTo ) ) // Intraday Only
                 {
                     oStock.Quotations.Remove( j );
                 }
             }
             file.WriteLine( "OK" );
         }
     }
}
watchlist.Close();
oAB.RefreshAll();
oAB.SaveDatabase();

WScript.Echo( "Done!" );

Since Windows scripting host is a separate process, by nature of out-of-process Windows automation, which involves marshaling between separate address spaces, this Javascript would be slower than anything else that runs inside the process.

It would be probably faster to:

  1. run exploration on daily data
  2. export the result
  3. re-import the result using ASCII importer.

Thank your valuable Reply.

Hi @Tomasz

Is there a quick way to delete quotation data for a time range for multiple symbols, even I have around 200 symbols.
The export / import is very fast but how can I get rid of the unwanted data.

Thanks.

There is Edit->Delete Range that deletes marked range of quotes from selected symbol. If you want multiple symbols you could use tools like "AutoIt" that would send keystrokes to save you from clicking manually.

1 Like

Sir i am not familiar with any coding knowledge after start using your Amibroker i gained little bit coding knowledge.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.