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

[amibroker] Re: Programatically set an exploration to run against a single watchlist



PureBytes Links

Trading Reference Links

Try this:

// Plots a chart of a watchlist
// copied from Yahoo! AmiBroker site
// Feb 2006

// You can change this to find the average percentage change of the group
// of stocks AND use this for the addtocompoiste

WLNum = Param("WatchList Num", 19, 0, 255, 1);
// WL 2  = Moose ;
// WL 10  = SP500 ;
// WL 11 = Oil&Gas ;
// WL 17 = R1K  ;
// WL 18 = R2K ;
// WL 19 = IBD100;
// WL 21 = Income;
EMALen  =  Param("EMA Length", 20, 4, 200, 1 );




function AvgForWatchList( listnum )
{
    // retrive comma-separated list of symbols in watch list
    list = CategoryGetSymbols( categoryWatchlist, listnum );

	global PctChng;
	
    Average = -10; // just in case there are no watch list members

    for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
    {
		pct = 100 * (Foreign( sym, "C" ) - Ref(Foreign( sym, "C"), -1)) /
Ref(Foreign( sym, "C"), -1) ;
       if( i == 0 ) Average = pct;
       else Average = Average + pct;
    }
		PctChng = Average / i ;    // divide by number of components
}

AvgForWatchList(WLNum) ;

Buy = 0;


--- In amibroker@xxxxxxxxxxxxxxx, "dawsonsg" <dawsonsg@xxx> wrote:
>
> Hi Guys,
> 
> I have an exploration that I only want to run against a set Watchlist. 
> 
> I can set this watchlist manually in the "Apply to" filter box but was 
> wondering if there is a way I can say programaically to run against a 
> certain watchlist only. 
> 
> I am aware I can use a filter "InWatchListName" but this still means 
> the exploration must run against every symbol in my database and 
> discard 6000 or so symbols I am not interested in. This works fine but 
> is slow. 
> 
> I was wondering if there was another way?
> 
> Regards
> Steve
>



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

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/