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

RE: [amibroker] Automating AA results handling (w/o Batman)



PureBytes Links

Trading Reference Links

Dave,

 

Here is a Jscript that I use to run AFL scripts one after another.   To be precise, it’s actually a hacked up version of what I use.   (My “production” script does logging and some error checking).    It shows how scans and explorations can be chained together.   It loads each AFL and its associated parameters and then executes the AFL.  

 

To execute multiple AFL scripts, just run the AFL scripts one after another like I have here.  If you wanted to be slick, you could instantiate the Broker.Application and Analysis once and then loop through changing the parameters.

 

You would need to edit this to your parameters (paths, files and other parameter settings) and then save it to a file in the ..\Scripts folder.  The file should have a “.js” extension.

 

You can call this Jscript file from the AB Tools Menu or you can schedule it to run using the Windows Scheduler. 

 

Regards,

 

Dan.

 

 

 

 

 

/* create AB object */

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

 

/* retrieve automatic analysis object */

AA = AB.Analysis;

 

/* load formula from external file */

AA.LoadFormula("C:\\Program Files\\AmiBroker\\Formulas\\Systems_DailyScans\\A1_QPATCIndexes_Count.afl")

 

/* setup filters */

/* backtest over symbols present in market 0 only (zero-based number) */

AA.ClearFilters();

 

/* set apply to and range */

AA.ApplyTo = 0; // use symbols

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

AA.RangeN = 1;

 

/* run Scan */

AA.Explore();

 

 

/* create AB object */

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

 

/* retrieve automatic analysis object */

AA = AB.Analysis;

 

/* load formula from external file */

AA.LoadFormula("C:\\Program Files\\AmiBroker\\Formulas\\Systems_DailyScans\\A2_QPAddCompositeIndexes7.afl")

 

/* setup filters */

/* backtest over symbols present in market 0 only (zero-based number) */

AA.ClearFilters();

 

/* set apply to and range */

AA.ApplyTo = 0; // use symbols

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

AA.RangeN = 1;

 

/* run Scan */

AA.Explore();

 

 

/* create AB object */

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

 

/* retrieve automatic analysis object */

AA = AB.Analysis;

 

/* load formula from external file */

AA.LoadFormula("C:\\Program Files\\AmiBroker\\Formulas\\Systems_DailyScans\\B_QPAddIndexRelativeStrength.afl")

 

/* setup filters */

/* backtest over symbols present in market 0 only (zero-based number) */

AA.ClearFilters();

AA.Filter( 0, "watchlist" ) = 49;

 

/* set apply to and range */

AA.ApplyTo = 2; // use filters

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

AA.RangeN = 1;

 

/* run backtest and display report */

AA.Scan();

 

 

/* create AB object */

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

 

/* retrieve automatic analysis object */

AA = AB.Analysis;

 

/* load formula from external file */

AA.LoadFormula("C:\\Program Files\\AmiBroker\\Formulas\\Systems_DailyScans\\C_QPAddIndexRank.afl")

 

/* setup filters */

/* backtest over symbols present in market 0 only (zero-based number) */

AA.ClearFilters();

AA.Filter( 0, "watchlist" ) = 48;

 

/* set apply to and range */

AA.ApplyTo = 2; // use filters

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

AA.RangeN = 1;

 

/* run backtest and display report */

AA.Scan();

 

 

/* create AB object */

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

 

/* retrieve automatic analysis object */

AA = AB.Analysis;

 

/* load formula from external file */

AA.LoadFormula("C:\\Program Files\\AmiBroker\\Formulas\\Systems_DailyScans\\G_CMFAndOBVToPriceLRDvrg_WLongTrend.afl")

 

/* setup filters */

/* backtest over symbols present in market 0 only (zero-based number) */

AA.ClearFilters();

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

 

/* set apply to and range */

AA.ApplyTo = 2; // use filters

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

AA.RangeN = 1;

 

/* run backtest and display report */

AA.Explore();

 

 

AB.SaveDatabase();

 

 

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of MarketMonk777
Sent: Tuesday, March 14, 2006 9:54 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Automating AA results handling (w/o Batman)

 

Hi Dan,

 

Thanks for the code below.  You wouldn’t happen to have any scripts that will automatically run a number of AAs in a batch mode do you?  

 

Dave

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Dan Clark
Sent: Tuesday, March 14, 2006 8:26 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Automating AA results handling (w/o Batman)

 

Brian,

 

Add this at the top:

 

CategoryRemoveSymbol("", categoryWatchlist, 1);  //Watchlist = 1

 

//Some criteria code

 

 

//Add Symbols to Watchlist 1

if (bCriteriaIsMet)

     CategoryAddSymbol( "" , categoryWatchlist, 1); //Watchlist = 1

     

 

 

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Brian
Sent: Tuesday, March 14, 2006 8:17 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Automating AA results handling (w/o Batman)

 

I used to have a small script that would automatically take
exploration results and put them in a specific watchlist. I have
looked at Batman but I think that might be overkill for what I need.
Only other functionality that would be nice is such a script would be
to automatically delete the contents of the watchlist prior to
repopulating it.

Anyone got this script handy? Mine got lost in the shuffle awhile back.

Thanks in advance!

Brian








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