PureBytes Links
Trading Reference Links
|
Hello,
I'm still having trouble getting the com interface working... the last
line throws an invalid cast exception.
string symbol = "^GSPC";
Broker.Application AB = new Broker.ApplicationClass();
Broker.Stocks stocks = (Broker.Stocks)AB.Stocks;
Broker.Stock stock = (Broker.Stock)stocks[symbol];
//this line throws an exception: System.InvalidCastException
Broker.Quotations quotations = (Broker.Quotations)stock.Quotations;
Obviously the conversion/cast fails... but how to cast it the right
way?
Thanks,
Dennis
--- 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",
"watchlist"
>
> 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 --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/
|