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

[amibroker] batch testing Please Help!



PureBytes Links

Trading Reference Links

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





------------------------ 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/