I think I have figured it out. The following are bits of code that I stole
from one of TJ's scripts.

FromDate = new Date;

/* year, month-1, day, hour, min, sec (required by JScript date constructor)
*/

ToDate = new Date; // current time

/* getVarDate is required to convert from JScript Date to OLE-automation
date */

AA.RangeFromDate = FromDate.getVarDate();

AA.RangeToDate = ToDate.getVarDate();

 

 

So the whole thing becomes as follows (in case somebody else wants to use
it)

 

AB = new ActiveXObject("Broker.Application");

AB.LoadDatabase("z:\\Amibroker\\Data");

AB.Visible = true;

 

/* retrieve automatic analysis object */

AA = AB.Analysis;

 

/* Explore over symbols and all quotes*/

AA.ClearFilters();

AA.ApplyTo = 0; // use all symbols

 

//AA.RangeMode = 1; // Last Day

//AA.RangeN = 1; // Last Bar

 

FromDate = new Date;

/* year, month-1, day, hour, min, sec (required by JScript date constructor)
*/

ToDate = new Date; // current time

/* getVarDate is required to convert from JScript Date to OLE-automation
date */

AA.RangeFromDate = FromDate.getVarDate();

AA.RangeToDate = ToDate.getVarDate();

 

AA.LoadFormula("c:\\amibroker\\Formulas\\1Production\\O2.afl");

AA.Explore();

AA.Export("c:\\Amibroker\\CSV FILES\\O2.csv");

 

 

From: [email protected] [mailto:[email protected]] On Behalf
Of ta
Sent: Thursday, September 03, 2009 3:56 PM
To: [email protected]
Subject: [amibroker] Dynamically setting RangeFromDate to todays date

 

  

Does anybody know how to dynamically set RangeFromDate to Todays date
(computer's current date).  I am using the following code to run an explore.
The problem is that it also picks up symbols that no longer trade . TIA

 

/********************Amibroker open to database***********************/

AB = new ActiveXObject("Broker.Application");

AB.LoadDatabase("z:\\Amibroker\\Data");

AB.Visible = true;

 

/* retrieve automatic analysis object */

AA = AB.Analysis;

 

/* Explore over symbols and all quotes*/

AA.ClearFilters();

AA.ApplyTo = 0; // use all symbols

AA.RangeN = 1; // Last Bar

//AA.RangeFromDate = 

//AA.RangeToDate = 

 

AA.LoadFormula("c:\\amibroker\\Formulas\\1Production\\O2.afl");

AA.Explore();

AA.Export("c:\\Amibroker\\CSV FILES\\O2.csv");



<<image001.jpg>>

<<image002.jpg>>

Reply via email to