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

Re: [amibroker] Results of Scan/Exploration



PureBytes Links

Trading Reference Links

Hi Stewart,

here is some code which demonstrates the use
of the Analysis module from within C++ (here the 
"Explore" part is used from within an other application).
In this example, it reads an AFL file named myscript.afl 
from ABtool directory which is in the AB dir. And, it puts 
the result into a text file named result.csv also in this dir. 
myscript.afl must contain a valid AFL script (ie.
at least Filter and AddColumn must be given).
It runs the script on the watchlist number 11 for the date
range 4/11/2003 to 4/14/2003 

UM

//--------------------------------------------------------------------
bool AB_Analysis_Module()
  { 
    Broker::IApplicationPtr pAmiBroker("Broker.Application");
    Broker::IAnalysisPtr    pAA = pAmiBroker->Analysis;
    if (pAA == 0)
       return false;
    if (pAA->LoadFormula("ABtool\\myscript.afl") == 0)
       return false;
    pAA->ClearFilters();
    pAA->ApplyTo   = 2;  // 0=all stocks, 1=current stock, 2=use filter
    pAA->RangeMode = 3;  // 0=all quotes, 1=n last quotes, 2=n last days, 3=from-to date 

    pAA->RangeFromDate = COleDateTime(2003, 4, 11, 0, 0, 0);
    pAA->RangeToDate   = COleDateTime(2003, 4, 14, 0, 0, 0);

    // if AppyTo == 2 --> set Filter here:
    pAA->PutFilter(0, "watchlist", 11);  // nType: 0=include, 1=exclude
                                         // Category: "index", "favorite", "market", "group", "sector", "index", "watchlist"
                                         // 3rd param: WL nbr

    pAA->Explore();
    pAA->Export("ABtool\\result.csv");

//  pAmiBroker->RefreshAll();
    return true;
  }


----- Original Message ----- 
From: Stewart 
To: amibroker@xxxxxxxxxxxxxxx 
Sent: Wednesday, April 23, 2003 12:56 AM
Subject: Re: [amibroker] Results of Scan/Exploration


Thanks Everyone,

I'll see if I can work it out with OLE.

Stewart
----- Original Message ----- 
From: Tomasz Janeczko 
To: amibroker@xxxxxxxxxxxxxxx 
Sent: Tuesday, April 22, 2003 11:52 PM
Subject: Re: [amibroker] Results of Scan/Exploration


Hello,

Why? Of course there is a way:
a) manual: see Export button
b) automatic 1: use Ole automation interface and Explore(), Export() methods of Analysis object 
(see user guide for the details)
c) automatic 2: create FileSystemObject in JScript and write text file directly from AFL formula.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: Stewart 
To: amibroker@xxxxxxxxxxxxxxx 
Sent: Tuesday, April 22, 2003 4:36 PM
Subject: [amibroker] Results of Scan/Exploration



There's no way to store the results of an Exploration to an array, right?

Thanks,

Stewart



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/yMx78A/fNtFAA/AG3JAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/