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

[amibroker] OLE Automation via Visual Foxpro



PureBytes Links

Trading Reference Links

Hello Friends,

I have been using the "Explore Feature of AA" since some time, and 
recently thought of going into its powers deeper by using OLE via 
Visual Foxpro (I have just a working knowledge of FoxPro. For 
automating the exploration I modified the code example a bit like :

>>>>>>>>>>
* create AB object */
AB = CreateObject("Broker.Application")

* retrieve automatic analysis object */ AA = AB.Analysis

* load formula from external file */
AA.LoadFormula("C:\\Program 
Files\\AmiBroker\\Formulas\\Custom\\TREND.afl")

* optional: load settings */
 AA.LoadSettings("C:\\Program 
Files\\AmiBroker\\Formulas\\Custom\\TREND.abs")

* set apply to and range */
AA.ApplyTo = 2&& use filters
AA.RangeMode = 1&&  n last quotes
AA.RangeN = 1

* setup filters */
* backtest over symbols present in market 0 only (zero-based number) 
*/
AA.ClearFilters()
AA.Filter(0,"watchlist") = 64
* uncomment line below to
&& AA.Filter( 1, "market" ) = 2; && exclude 2nd market 

* run backtest and display report */
AA.Explore()  && IMPORTANT: you need to specify parameter 0 to get 
PORTFOLIO backtest
AA.Report("C:\\Hello\\DATAOUT\\report.txt") && empty file name means 
display report
>>>>>>>>>>>>>>>>


When I run this routine in Visual FoxPro I get error "function 
argument value, type, or count is invalid" on the line 
"AA.Filter(0,"watchlist") = 64"

This routine works find if I comment out the particular line, it is 
just that the routine works on all the securities in database. 
Secondly, I do not get the report saved to the file as mentioned above 
- I just get the displayed report.

The Amibroker Support has been kind to guide me that :

>>>>>>>>>>>>>
You must take attention to pass the watch list name BY VALUE.

Consult the manual for Foxpro how to pass BY VALUE.
In Visual Basic for example the function CStr is used for that 
purpose:

AA.Filter(0,CStr("watchlist")) = 64
>>>>>>>>>>>>>

Since my knowledge of Foxpro is also very basic, I could not find a 
way out even after guidance of AmiBroker support. I am looking forward 
to guidance of some Amibroker users having knowledge of Foxpro to help 
me implement the solution as suggested by AB Support.

Please accept my gratitude for the solution.

With regards

Sanjiv Bansal


------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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