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

[amibroker] Re: Specifying Watchlist from AFL



PureBytes Links

Trading Reference Links

Dingo, Padhu, PS, and Joe,

Thanks for your input.  I haven't had time to digest it all, but I 
hope to get enough time this weekend to attack and conquer this 
subject.  I will report back with what works best for me.

Ron

--- In amibroker@xxxxxxxxxxxxxxx, "Joe Landry" <jelandry@xxx> wrote:
>
> Ron...From a first glance it looks to me like you need to drive 
your AFL scripts externally with Batman or a multistep j - script.  
With this approach you can specify the watchlist, filter databases 
and AFL externally before you drive AB and run the AFL on an 
exploration.  I have a nightly run where I do this so it sounded to 
me like this is a similar requirement.  The script below generates 
some ATCs for the "Mango Kayak" style charts.  
> 
> HTH
> Joe 
> 
>  // 
> // RUN AS AN SCAN
> // USE R2000 components in Watchlist 35 
> // 
> //  
> // WILL PRESENT 3 MESSAGES 1) Amibroker found running, 2) AFL 
loaded successfully,3) Composites completed
> 
> 
> // Test to see if Amibroker is Open
> // If so, do nothing , If not, start Amibroker
> // Create a Shell Object
> var oWinMgM = GetObject("WinMgmts://localhost")
> var oWSH = WScript.CreateObject("WScript.Shell")
> // We have not looked for or found Amibroker yet, record this below
> ABFound = false
> // Get a list of Amibroker instances currently running (which maybe 
none)
> var ABList = oWinMgM.ExecQuery ("select * from Win32_Process where 
name='Broker.exe'")
> // go through the list
> var e = new Enumerator(ABList);
>   for (;!e.atEnd();e.moveNext())
>    {
>  // if one exists, note that
>  ABFound = true;
>  }
> if (ABFound == true)  //then we must have found Amibroker running
>  {
>  Result = oWSH.popup("Amibroker Found...", 1,"Job Status", 64)
>  }
> else      //otherwise let's start it
>  {
> 
>  Result = oWSH.popup("Amibroker NOT Found...", 1,"Job Status", 64);
>  oWSH.CurrentDirectory = "C:\\Program 
Files\\AmiBroker2nd\\Amibroker"
>  Result = oWSH.Run ("Broker.exe", 5, false)  //Start it, regular 
window, don't wait
>  }
> WScript.Sleep(3000) //Wait 3 seconds for it to start
> 
> // Define AB 
> AB = new ActiveXObject("Broker.Application");
>  
> /* retrieve automatic analysis object */
> AA = AB.Analysis;
> 
> // 
> // ========================  Cut and Paste from here for additional 
job steps ====== 
> // Load 1st Formula in job step  
> if(AA.LoadFormula("C:\\program 
files\\amibroker\\afl\\Composites\\KAYAK_ATC.afl"))
> 
>  {
> oWSH.popup("Russell 2000 ATC Loaded Successfully",1,"Status",64);
>  }
> 
> /* setup filters */
> /* SCAN over symbols in the watchlist
> AA.ClearFilters(); 
> // load a ticker with a long history
> var ABD = AB.Documents;
> var ticker = "!RUT"; 
>     ABD.Open(ticker);   // Point to !RUT -  QP3 ticker name 
>     Open_Ticker = AB.ActiveDocument.Name;
> //    WScript.Echo ("Current Stock = " + Open_Ticker );
>  
> /* set apply to and range */
> AA.ApplyTo =   2; // use filters  0 all symbols, 1 current symbol, 
2 use filter
> AA.Filter(0,"watchlist")= 35; 
> AA.RangeMode = 1; // use number of quotations below
> AA.RangeN =    1008; // for four years 
> /* run SCAN */
> AA.scan();
>  
>   WScript.Echo("R 2000 ATC Composites stored in Group 253");
>  
>  // ==========================  Rank for top ten stocks in each 
subsector ================//
>  //
>  
>  
> AB.refreshall();
>  
>  
>  
>  
>  
>  
> 
>   ----- Original Message ----- 
>   From: Ron Rowland 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Tuesday, October 09, 2007 4:25 PM
>   Subject: [amibroker] Specifying Watchlist from AFL
> 
> 
>   I was hoping to find a way to easily set/specify the Watchlist to 
be 
>   used by a given AFL. My preferred approach is "A" blow, but it 
does 
>   not appear to a valid/supported one.
> 
>   A) The SetOption command allows me to override/set about 26 
>   parameters used/required by the AA window. However, the 
>   documentation does not show a way to specify which 
Watchlist/Filters 
>   to use. I would like to be able to simply say SetOption
>   (WatchlistName, "MyWatchList");
> 
>   B) I have searched this group and it appears that this task can 
be 
>   accomplished using the "Automate a Backtest and Export the 
Tradelist" 
>   script that Dingo wrote back in April 2004.
> 
>   C) I also assume that it can be accomplished in the CBT by 
enabling 
>   the Analysis Object and using the Filter Property.
> 
>   D) I think it might also be possible using a brute-force approach 
by 
>   running all of my AFLs from a Watchlist named "UseThisOne" and 
then 
>   each AFL would use CategoryRemoveSymbol to clear out "UseThisOne" 
and 
>   then rebuild it by using CategoryGetSymbol from 
>   Watchlist "TheOneIReallyWant" and then have CategoryPutSymbol 
each 
>   symbol into "UseThisOne". (Brute force and very ugly approach).
> 
>   Since my preferred approach "A" is not a valid one, does anyone 
have 
>   an opinion on which approach is preferred? Any other way of 
>   accomplishing this task?
>




Please note that this group is for discussion between users only.

To get 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/