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

Re: [amibroker] Re: Announcing ABtool v0.9.3.6



PureBytes Links

Trading Reference Links




Fred,
 
Are you aware of OLE automation interface ?
See User's Guide: Reference Guide:
"automation object model":
 

New Analysis object.
Analysis object (accessible via 
Broker.Application.Analysis)Methods:- Backtest(); - runs 
backtest - Explore(); - runs exploration- Scan(); - runs scan- 
Optimize(); - runs optimization- bool Report( FileName: String ) - saves 
report to the file or displays it if FileName = "" - bool Export( FileName: 
String ) - exports result list to CSV file- bool LoadFormula( FileName: 
String ) - loads AFL formula- bool SaveFormula( FileName: String ) - saves 
AFL formula- bool LoadSettings( FileName: String ) - loads backtest 
settings- bool SaveSettings( FileName: String ) - saves backtest 
settings- ClearFilters() - removes all filters 
Properties:- long ApplyTo - defines apply to mode: 0 - all 
stocks, 1 - current stock, 2 - use filter- long RangeMode - defines range 
mode: 0 - all quotes, 1 - n last quotes, 2 - n last days, 3 - from-to date- 
long RangeN - defines N (number of bars/days to backtest)- DATE 
RangeFromDate - defines "From" date- DATE RangeToDate - defines "To" 
date- Filter( nType: short, Category : String ) - sets/retrieves filter 
settingnType argument defines type of filter 0 - include, 1 - 
excludeCategory argument defines filter category:"index", "favorite", 
"market", "group", "sector", "index", 
"watchlist"ExamplesClearFilters(); // 
clear all filters firstFilter( 0, "index" ) = 1; // include only 
indicesFilter( 1, "market" ) = 2; // exclude 2nd 
marketFull Example for Windows Scripting 
Host:========================================
  
  /* create AB object */AB = new 
  ActiveXObject("Broker.Application");
  /* retrieve automatic analysis object */AA = 
  AB.Analysis;
  /* load formula from external file 
  */AA.LoadFormula("afl\\macd_c.afl");
  /* optional: load settings */// 
  AA.LoadSettings("the_path_to_the_settings_file.abs");
  /* setup filters *//* backtest over symbols present 
  in market 0 only (zero-based number) */AA.ClearFilters(); AA.Filter( 
  0, "market" ) = 0;
  /* set apply to and range */AA.ApplyTo = 2; // use 
  filtersAA.RangeMode = 0; // use all available quotes
  /* run backtest and display report 
  */AA.Backtest();AA.Report(""); // empty file name means display 
  report
Example 2: Batch backtesting
Caution: It will run backtest of EVERY formula stored in C:\Program 
Files\AmiBroker\AFLon all stocks of current database. After each backtest 
the report is generated and savedinto the file named <formula 
name>.HTML.You can modify this AFL path in the script itself (you can 
open it with Notepad). Below comes the listing.
/******************************* 
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*/
<FONT 
face="Courier New">AFLFolder = "C:\\Program Files\\AmiBroker\\AFL"; // 
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 
symbolsAA.RangeMode = 0; // all quotes
 
/* to use filters you should uncomment 
lines below
 
// AA.ApplyTo = 2; // use filters// 
AA.Filter(0,"watchlist") = 2 /* watch list number */;// AA.Filter(0,"group") 
= 0 /* group 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");
 
 
 
 
 
Best regards,Tomasz Janeczkoamibroker.com
----- Original Message ----- 
From: "Fred" <<A 
href=""><FONT 
size=2>fctonetti@xxxxxxxxx>
To: <<A 
href=""><FONT 
size=2>amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, May 11, 2003 1:43 AM
Subject: [amibroker] Re: Announcing ABtool 
v0.9.3.6
> Uenal,> > 
With regards to EXEcuting external programs, it would be extremely > 
helpful to be able to from within AFL run an EXPLORE followed by an > AA 
followed by a ? and at each juncture be able to change ANY and ALL > the 
settings not just the ones that are currently allowable in AFL > i.e. the 
radials etc.> > Any chance for a modification to accomplish this 
?> > Fred> > --- In <A 
href=""><FONT 
size=2>amibroker@xxxxxxxxxxxxxxx, "Fred" <<A 
href="">fctonetti@x<FONT 
size=2>...> wrote:> > Uenal,> > > > Thanks for 
the new features.> > > > This is an EXTREMELY beneficial 
tool and will be even more so with > > the new features.> > 
> > Thanks again, Fred> > > > --- In <A 
href=""><FONT 
size=2>amibroker@xxxxxxxxxxxxxxx, <A 
href="">uenal.mutlu@x<FONT 
size=2>... wrote:> > > The latest version of the ABtool plugin for 
AB can be found at > the > > following locations:> > 
>  - File area of the "amibroker" group at yahoo:> > 
>      <A 
href=""><FONT 
size=2>http://groups.yahoo.com/group/amibroker/files/ABtool/<FONT 
size=2>> > > > > >  - In the support area / 3rd party 
downloads at <FONT 
size=2>www.amibroker.com:> > 
>      <A 
href=""><FONT 
size=2>http://www.amibroker.net/3rdparty.php> 
> > > > >  - Or, email me:> > 
>      <FONT 
size=2>uenal.mutlu@x...> > > > > 
> HIGHLIGHTS OF THIS VERSION (see also History and ToDoList at the > 
> end of the reference file):> > >      
- Multi-Dimensional arrays> > >      - Log 
file for user's own use> > >      - 
Starting other programs from within AFL> > 
>      - Getting/Setting environment 
variables> > >      - Getting Date and 
Time of today> > >      - Getting Day of 
Week (DOW)> > >      - Getting current 
directory> > >      - Exporting optionally 
only the top N rows of a table> > > > > > Below is an 
example for the use of multidimensional arrays.> > > Please note, 
that from now on all ABtool plugin functions have to > > be prefixed 
> > > with an "xx". For details see the reference text file in the 
> > distribution archiv.> > > > > > 
UM> > > > > > 
//----------------------------------------------------------------> 
--> > ------------> > > // ArrayXXX.afl> > > 
// Multidimensional Arrays in ABtool plugin v0.9.3.6+> > > // 
Written 030510Sa by Uenal Mutlu> > > > > 
>    xxABtoolInit();> > >    
Filter = True;> > >    AddTextColumn(xxDirCurGet(), 
"curDir");> > > > > >    // a 4D array 
with 4x6x15x30 elements of type 12 (int16; see > Doc)> > 
>    hArr = xxArrayCreate(12, 0,  4, 6, 15, 30);> 
> >    if (hArr >= 0)> > 
>      {> > 
>        for (i1 = 0; i1 <  4; 
i1++)> > >        for (i2 = 0; 
i2 <  6; i2++)> > 
>        for (i3 = 0; i3 < 15; 
i3++)> > >        for (i4 = 0; 
i4 < 30; i4++)> > 
>          {> > 
>            valA = 
100 + i1 + i2 + i3 + i4;   // testvalue> > > > 
> >            // 
set element content> > 
>            
xxArrayNumValSet(valA, hArr, i1, i2, i3, i4);> > > > > 
>            // get 
element content> > 
>            valB = 
xxArrayValGet(hArr, i1, i2, i3, i4);> > > > > 
>            
//...> > >          
}> > > > > >        
//...> > > > > 
>        xxMsgBox("Array filled", 
"Success");> > >        
xxArrayDelete(hArr);    // release the handle and the > 
memory > > it had used> > >      
}> > >    else> > 
>      xxMsgBox("Array could not be created. Check 
Dim > > params!", "Error!", 16);> > > 
//----------------------------------------------------------------> 
--> > ------------> > > ------------------------ 
Yahoo! Groups Sponsor ---------------------~-->> Rent DVDs from 
home.> Over 14,500 titles. Free Shipping> & No Late Fees. Try 
Netflix for FREE!> <A 
href=""><FONT 
size=2>http://us.click.yahoo.com/BVVfoB/hP.FAA/uetFAA/GHeqlB/TM<FONT 
size=2>> 
---------------------------------------------------------------------~->> 
> Send BUG REPORTS to <FONT 
size=2>bugs@xxxxxxxxxxxxx> Send SUGGESTIONS to 
<FONT 
size=2>suggest@xxxxxxxxxxxxx> 
-----------------------------------------> Post AmiQuote-related messages 
ONLY to: <FONT 
size=2>amiquote@xxxxxxxxxxxxxxx > (Web page: 
<FONT 
size=2>http://groups.yahoo.com/group/amiquote/messages/<FONT 
size=2>)> --------------------------------------------> Check 
group FAQ at: <A 
href=""><FONT 
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
size=2> > > Your use of Yahoo! Groups is subject to <A 
href=""><FONT 
size=2>http://docs.yahoo.com/info/terms/ > 
> > 






Yahoo! Groups Sponsor












Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.