I wrote the following script to delete daily data bars in an intraday
database. Scripts really run slow, like many hours, and I was
wondering if this could be coded in AFL and run as a Scan. I run a
scan to export all intraday data and it takes a few minutes while the
script runs for hours and hours.
I just want to know if I can delete daily bars using an AFL formula
in Analysis>Scan using the object model, or some other way.
Thanks,
Barry
/*
** AmiBroker/Win32 Scripting Program
**
** File: DeleteDailyInIntraday.js
** Created: Barry Scarboroughm Feb 23, 2007
** Purpose: Cleanup the database when daily data is in the intraday
database.
** Language: JScript (Windows Scripting Host)
*/
var oAB = new ActiveXObject("Broker.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var Shell = new ActiveXObject("WScript.Shell");
var oStocks = oAB.Stocks;
var numStocks = oStocks.Count;
var oStocksToDelete = new Array;
WScript.Echo("Deleting daily data in intraday database. " );
for( i = 0; i < numStocks; i++ )
{
oStock = oStocks( i );
var qty = oStock.Quotations.Count;
for(j = 0; j < qty; j++)
{
oQuote = oStock.Quotations( j );
var oDate = new Date( oQuote.Date ); // create date object
hour = oDate.getHours();
min = oDate.getMinutes();
sec = oDate.getSeconds();
if (hour == "0" && min == "0" && sec == "0" )
{
oQuote.Remove;
}
}
}
oAB.RefreshAll();
WScript.Echo("Finished deleting daily data in intraday database." );