PureBytes Links
Trading Reference Links
|
Sirry have never used it but looking at the code i have in my scripts folder
/* to use filters you should uncomment lines below
AA.ApplyTo = 2;
AA.Filter(0,"watchlist") = 3 ;
you needto remove the block comment from the lines
/* to use filters you should uncomment lines below */
AA.ApplyTo = 2;
// AA.Filter(0,"watchlist") = 3 ;
now set your filters for bars/dates and watchlist in AA
Have you set the correct path to your group of AFL scan files in this line
AFLFolder = "C:\\Program Files\\AmiBroker\\AFL";
Do the AFL files within this folder have actual buy/sell conditions?
On 10/18/05, jeffro861 <jhend746@xxxxxxxxxxxxx> wrote:
> Ok I've changed it and here's what I have.
>
>
> /*****************************
> *
> * BatchTest.js
> *
> * Batch testing sample script
> * Shows how to use JScript and new AmiBroker 4.23
> * 'Analysis' object to perform batch backtesting
> * and generate reports
> *
> * Created: Dec 21, 2002 TJ
> * Last modification: Dec 22, 2002 TJ
> *
> * Copyright (C)2002 Amibroker.com
> *
> * Status: Freeware
> * You can use/modify/adopt this code freely
> *
> */
> /* The directory where AFL files are stored
> ** Also reports generated by the bactest
> ** will be saved here
> */
>
> AFLFolder = "C:\\Program Files\\AmiBroker\\formulas\\systems"; //
> MODIFY TO FIT YOUR SETUP
> WScript.Echo("Batch testing of all AFL files stored in " +
> AFLFolder );
> var AB, AA;
> var fso, f, f1, fc, s;
> var filename;
> /* Create AmiBroker object and get Analysis object */
> AB = new ActiveXObject("Broker.Application");
> AA = AB.Analysis;
> /* backtest over symbols and all quotes*/
> AA.ClearFilters();
> AA.ApplyTo = 0;
> AA.RangeMode = 3;
> AA.rangefromdate=1020321;
> AA.rangetodate=1040310;
> /* to use filters you should uncomment lines below
> AA.ApplyTo = 2;
> AA.Filter(0,"watchlist") = 3 ;
>
>
>
> /* Create FileSystemObject */
> fso = new ActiveXObject("Scripting.FileSystemObject");
> /* Iterate through all files in the folder */
> f = fso.GetFolder(AFLFolder);
> fc = new Enumerator(f.files);
> for (; !fc.atEnd(); fc.moveNext())
> {
> // we need to add empty string to make sure that filename is a string
> object
> filename = "" + fc.item();
> /* check the AFL extension */
> if( filename.substr( filename.length - 4 ).toUpperCase() == ".AFL" )
> {
> if( AA.LoadFormula( filename ) )
> {
> AA.Backtest();
> reportname = filename.substr( 0, filename.length - 3 ) + "HTML" ;
>
> AA.Report( reportname ); // generate report
> }
> }
> }
> WScript.Echo("Batch backtest finished");
>
>
> When I try to run it, I still get the error message, "missing
> buy/sell variable assignaments."
>
> Any other suggestions? This seems like a complicated problem but
> would be easy for someone who understands java and AFL.
>
> Thanks,
> Jeff
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> >
> > Have not used it but these lines are what would provide the
> filtering
> >
> > /* backtest over symbols and all quotes*/
> > AA.ClearFilters();
> > AA.ApplyTo = 0; // use symbols
> > AA.RangeMode = 0; // all quotes
> > AA.rangefromdate=3/21/01;
> > AA.rangetodate=3/10/04;
> > /* to use filters you should uncomment lines below
> > AA.ApplyTo = 2; // use filters
> > AA.Filter(0,"watchlist") = 3 /* watch list number */;
> >
> > note it says "to use filters you should uncomment lines below" and
> has
> > a block comment around the last 3 lines
> >
> >
> > On 10/18/05, jeffro861 <jhend746@xxxx> wrote:
> > > I'm having problems with batch testing after I've put the
> following
> > > script in:
> > >
> > >
> > > /*****************************
> > > *
> > > * BatchTest.js
> > > *
> > > * Batch testing sample script
> > > * Shows how to use JScript and new AmiBroker 4.23
> > > * 'Analysis' object to perform batch backtesting
> > > * and generate reports
> > > *
> > > * Created: Dec 21, 2002 TJ
> > > * Last modification: Dec 22, 2002 TJ
> > > *
> > > * Copyright (C)2002 Amibroker.com
> > > *
> > > * Status: Freeware
> > > * You can use/modify/adopt this code freely
> > > *
> > > */
> > > /* The directory where AFL files are stored
> > > ** Also reports generated by the bactest
> > > ** will be saved here
> > > */
> > >
> > > AFLFolder = "C:\\Program Files\\AmiBroker\\formulas\\systems"; //
> > > MODIFY TO FIT YOUR SETUP
> > > WScript.Echo("Batch testing of all AFL files stored in " +
> > > AFLFolder );
> > > var AB, AA;
> > > var fso, f, f1, fc, s;
> > > var filename;
> > > /* Create AmiBroker object and get Analysis object */
> > > AB = new ActiveXObject("Broker.Application");
> > > AA = AB.Analysis;
> > > /* backtest over symbols and all quotes*/
> > > AA.ClearFilters();
> > > AA.ApplyTo = 0; // use symbols
> > > AA.RangeMode = 0; // all quotes
> > > AA.rangefromdate=3/21/01;
> > > AA.rangetodate=3/10/04;
> > > /* to use filters you should uncomment lines below
> > > AA.ApplyTo = 2; // use filters
> > > AA.Filter(0,"watchlist") = 3 /* watch list number */;
> > >
> > >
> > >
> > > /* Create FileSystemObject */
> > > fso = new ActiveXObject("Scripting.FileSystemObject");
> > > /* Iterate through all files in the folder */
> > > f = fso.GetFolder(AFLFolder);
> > > fc = new Enumerator(f.files);
> > > for (; !fc.atEnd(); fc.moveNext())
> > > {
> > > // we need to add empty string to make sure that filename is a
> string
> > > object
> > > filename = "" + fc.item();
> > > /* check the AFL extension */
> > > if( filename.substr( filename.length - 4 ).toUpperCase()
> == ".AFL" )
> > > {
> > > if( AA.LoadFormula( filename ) )
> > > {
> > > AA.Backtest();
> > > reportname = filename.substr( 0, filename.length - 3 ) + "HTML" ;
> > >
> > > AA.Report( reportname ); // generate report
> > > }
> > > }
> > > }
> > > WScript.Echo("Batch backtest finished");
> > >
> > >
> > >
> > >
> > > My problem is that I can't get the script to only include a
> specific
> > > watchlist and a specific to and from date. Please help! I've
> been
> > > battling this for a month. Also please note that I'm trying to
> batch
> > > test one long and one short system and I sometimes I get an error
> > > message saying that I don't have "buy" and "sell" statements in
> the
> > > forumula which is not true.
> > >
> > > TIA,
> > > Jeff
> > >
> > >
> > >
> > >
> > >
> > >
> > > 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
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Cheers
> > Graham
> > AB-Write >< Professional AFL Writing Service
> > Yes, I write AFL code to your requirements
> > http://e-wire.net.au/~eb_kavan/ab_write.htm
> >
>
>
>
>
>
>
>
> 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
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|