PureBytes Links
Trading Reference Links
|
Dingo and Lester, thank you for replying. I've managed to figure it
out (I think). Here's the code for any others who might have the
same problem:
IndList=CategoryGetSymbols(categoryWatchlist,4);
for (i=0;StrExtract(IndList,i)!="";i++)
{
if (StrExtract(IndList,i)==IndustryID(1))
{
CategoryAddSymbol("",categoryWatchlist,8);
}
}
AddColumn(C,"Close");
Filter=1;
How it works:
I get a list of industry names through another scan I have. I add
that list to watchlist #4 (thus, the "4" in the first line). Then I
run the above code to add all the stocks in each industry listed in
watchlist #4 to watchlist #8 (thus, the "8" in line 6). This would
probably work better as a scan, but I use it as an exploration on
all common stocks.
In order to work, you have to make sure that the industry names in
your watchlist match the real industry names exactly, and your
stocks are properly classified by industry.
Jeff
--- In amibroker@xxxxxxxxxxxxxxx, "fatboycato" <fatboycato@xxx>
wrote:
>
> Hello,
>
> I'm trying to figure a faster way to add all symbols from a
> particular industry into a watchlist. I have an exploration that
> will return the text names of the industries I want the stocks to
> come from. My idea was to add the results of this exploration to a
> watchlist, then perform another exploration on this watchlist
which
> would look at the name of each industry in the watchlist and use
> that to return all stocks in those industries. The code would look
> something like this:
>
> //Explore on watchlist "Industries"
> IndName=[Symbol Name];
> CategoryGetSymbols(categoryIndustry,IndName);
>
> Now, this won't work for a couple reasons: 1) I don't know how to
> reference the [Symbol Name], and 2) the CategoryGetSymbols()
> function needs a number for the index parameter. So, I would need
a
> way to reference the industry name (provided in the watchlist) and
> relate that name to its proper numerical index.
>
> This certainly doesn't have to be the solution. I'm just looking
for
> a way to add all the stocks from a particular industry into a
> watchlist without having to "right-click/Watchlist/Add selected
> symbol to watchlist".
>
> Thank you very much for any help you can provide.
>
> Jeff
>
|