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

RE: [amibroker] re 21 day ma of OBV



PureBytes Links

Trading Reference Links

Thomasz,

I got the following code to work when calling the old backtester 
(aa.Backtest(2);) but the call to aa.Backtest(0) or aa.Backtest(1) 
seems to cause a hang.  Do you have any idea what it could be?

---------------------------------
Broker.Application ab = new Broker.ApplicationClass();
Broker.Analysis aa = (Broker.Analysis) ab.Analysis;

ab.LoadDatabase("C:\\Program Files\\AmiBroker\\Data");
Boolean loaded = aa.LoadFormula("c:\\Program 
Files\\AmiBroker\\AFL\\CCIopt.afl");
Boolean settingsLoaded = aa.LoadSettings("c:\\Program 
Files\\AmiBroker\\AFL\\default.ABS");

aa.ClearFilters();
aa.ApplyTo = 0; // use symbols
aa.RangeMode = 0; // all quotes

aa.Backtest(2);
aa.Export("c:\\temp\\test.csv");
---------------------------------

I would really appreciate it if I got a response on this one.  Since 
I got everything to work except this last piece.

Thanks,
-David

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> Optimize() /Backtest() does not take any object as a parameter. It 
just takes INTEGER.
> 
> See users guide:
> http://www.amibroker.com/guide/objects.html
> 
> Analysis object (accessible via Broker.Application.Analysis)
> 
> Methods:
> - Backtest( Type = 2 ); - runs backtest 
> Type can be one of the following values:
> 0 : portfolio backtest/optimize
> 1 : individual backtest/optimize
> 2 : old backtest/optimize
> 
> - Explore(); - runs exploration
> - Scan(); - runs scan
> - Optimize(Type = 2 ); - runs optimization
> Type can be one of the following values:
> 0 : portfolio backtest/optimize
> 1 : individual backtest/optimize
> 2 : old backtest/optimize
> 
> - 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 
setting
> nType argument defines type of filter 0 - include, 1 - exclude
> Category argument defines filter category:
> "index", "favorite", "market", "group", "sector", "index", "watchlis
t"
> 
> All it does is triggers backtest/optimize.
> 
> To get the results you have to call EXPORT to export result table 
to CSV file and
> then you can do your own computations (by reading values from the 
file).
> 
> 
> As for LoadFormula - it takes the FILE PATH parameter - the path to 
the file stored
> 
> on your hard disk that you want to load.
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> 
> ----- Original Message ----- 
> From: "yund" <yund@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, August 26, 2004 11:11 PM
> Subject: [amibroker] COM and C#
> 
> 
> > Hi all,
> > 
> > I'm trying to interface to Amibroker through COM using C#.  I 
> > download the broker.tlb type library.
> > 
> > I'm trying to do something similar to:
> > OptimizationBatch.js
> > http://www.amibroker.com/library/detail.php?id=377
> > 
> > Here are some code snippet that I already wrote:
> > ------------------------------------------
> > Broker.Application ab = new Broker.ApplicationClass();
> > Broker.Analysis aa = (Broker.Analysis) ab.Analysis;
> > 
> > Object obj = new object();
> > 
> > Boolean loaded = aa.LoadFormula("c:\\Program
> > Files\\AmiBroker\\AFL\\CCIopt.afl");
> > aa.ClearFilters();
> > aa.ApplyTo = 0;
> > aa.RangeMode = 0;
> > aa.Optimize(obj);
> > -------------------------------------------
> > 
> > I'm not entirely clear on all the data types and how to access 
them, 
> > since it doesn't seem to be documented.  Does anyone have some 
code 
> > samples to do the following.
> > 
> > 1.  How do I make the call to aa.Optimize(Object Type) or 
aa.Backtest
> > (Object Type)?
> > 2.  How do I extract the data after making the calls to 
aa.Optimize
> > (Object Type) and aa.Backtest(Object Type)?
> > 3.  How do I generate a AFL script string to pass to aa.Optimize
> > (Object Type) and aa.Backtest(Object Type) other than generating 
a 
> > file and calling aa.LoadFormula(String)?
> > 
> > Help will be greatly appreciated and any advice would be great, 
since 
> > I'm a newbie to Amibroker user.
> > 
> > Thanks,
> > -David
> > 
> > 
> > 
> > 
> > 
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> > 
> > Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> > 
> 
> [Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/