[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Help Please: Running AB Scans from Command Line



PureBytes Links

Trading Reference Links

Title: Help Please: Running AB Scans from Command Line
Dan,
 
This is only a hunch...  I did not do any testing. 
 
Under Tools, Prefs, Misc., if you have Layouts selected under "Save on exit", I would try unselecting it.  
 
I hope this helps.
 
Perry Lentine


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Dan Clark
Sent: Monday, December 26, 2005 9:44 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Help Please: Running AB Scans from Command Line

Hi,

To automate my daily scan and exploration processing, Ive created several JScripts that execute from the Windows command line.  The scripts instantiate a new AB object and then run an AFL file.  The scripts work fine IF AB is running, but fail if AB is NOT running.  

To solve this, my first solution was to run AB from a .cmd batch file and then call my scripts.   It works, but has some hassles.

My second solution was to add oAB.LoadDatabase() to my code.   The good news is that my JScripts now work without having to run AB separately.  (Test code below.)   But

The bad news is that my AB default layout gets deleted!  I.e., after I run the command line Jscript and then open AB manually, my default layout is gone!

Overall, is this the best approach to automate scans and explorations?    Do you see any bugs in the code below?   

Thanks in advance for any help.

Regards,

Dan.


var sDBFileLocation = "C:\\Program Files\\AmiBroker\\QuotesPlus_Stocks";

var oAB, oAA;

//Create AB object

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

//Load DB

if(oAB.LoadDatabase(sDBFileLocation) == true)

   {

   WScript.Echo("DBLoaded");

   }

oAA = oAB.Analysis;

/* load formula from external file */

oAA.LoadFormula("C:\\Program Files\\AmiBroker\\Formulas\\Systems\\Test.afl");

oAA.ClearFilters();

oAA.Filter( 0, "watchlist" ) = 1;

/* set apply to and range */

oAA.ApplyTo    = 2; // use filters

oAA.RangeMode  = 2; // use last day's quotes

oAA.RangeN     = 1;

/* run backtest and display report */

oAA.Explore();

oAB.SaveDatabase();

oAB.Quit();



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS