PureBytes Links
Trading Reference Links
|
Have a look at CategoryAddSymbol
SYNTAX CategoryAddSymbol( symbol, category, number )
RETURNS NOTHING
FUNCTION The CategoryAddSymbol function adds the symbol to given category,
note that for markets, groups, industries 'adding' means moving from one
category to another, since the symbol is assigned always to one and only one
market, group, industry and sector. This limitation does not apply to
watchlists, favorites, and index categories. When symbol string is empty
("") then current symbol is used.
category is one of the following:
categoryMarket
categoryGroup
categorySector
categoryIndustry
categoryWatchlist
categoryFavorite
categoryIndex
number is a market/group/industry/sector/watchlist number:
0..255 for categoryMarket, categoryGroup, categoryIndustry
0..63 for categorySector, categoryWatchlist.
ignored for categoryFavorite, categoryIndex
Cheers,
Graham
http://e-wire.net.au/~eb_kavan/
-----Original Message-----
From: Jean-Yves [mailto:jean-yves.casalis@xxxxxxxxxx]
Sent: Tuesday, August 10, 2004 2:50 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Industry setting to a watch list
Thanks again Stefan, Dingo already gave me the pointer to these
scripts; I think it'll make it :-)
Anyway, as you asked the question, i'll just try to explain a little
bit what I'm trying to do..
I have imported in AB many warrants; I don't want to put them in
their "real" industries and for... hum... probably bad reasons, I
can't let these stocks assigned to the default industry since some
of my customed indicators use this default industry for... ahem... a
reason I'm not sure to remember exactly quite now !!
Anyway, my idea was then to move all these warrant tickers from
default industry to a new 'Warrant' pseudo-industry. As simple as
that on the paper, more painful in reality ;-)
But, as there is always a benefit from any problem, this will force
me to take a deeper look at scripting with AB; this could be
probably very helpful in the future :)
Thanks again for your help :)
Regards,
Jean-Yves
--- In amibroker@xxxxxxxxxxxxxxx, "sgfuchs" <sgfuchs@xxxx> wrote:
> Jean-Yves,
>
> a question : what exactly are you trying to achieve - do you want
> simply a composite index or are these 250 French stocks really from
> only one real industry group ?
>
> If thats the case, the easiest way would of course be, to rename
your
> watchlist according to the industryname - :-) just kidding
>
> You could use i.e. the addtocomposite functions if you just need an
> average index.
>
> Recommended reading :
> http://www.amibroker.net/3rdparty/IntroToAtc.pdf
>
> Else maybe you find the following helpful from the AB helpfiles :
>
> "4 Tip of the week: : How to automate assigning stocks to
> sectors/industries ?
>
> Note: This functionality is available only in Windows version of
> AmiBroker
>
> In the first issue of AmiBroker Tips newsletter AmiBroker I
discussed
> using of AmiBroker's OLE automation interface for accessing stock
> data. In this article I will give you another example of
automation:
> assigning stocks to industries using simple JScript. For starters I
> recommend reading the first article before proceeding with this
one.
>
> First we should set up our sectors and industries using
> Stock->Categories window. The difference between a sector and an
> industry is that industries "belong" to sectors, for example: "Air
> Courier", "Airline", "Railroads", "Trucking" industries belong to
> "Transportation" sector. So an assignment to an industry implicts
> assignment to a sector. If you don't want to have detailed
industries
> you can just assign first 32 industries to 32 sectors on one-by-one
> basis.
>
> Now let's suppose that we have a text file that contains tickers,
full
> company names and a industry number. Industry number should
correspond
> our settings in Categories window. A sample file would look like
this:
>
> ELM,ELINK MEDIA LIMITED,0
> GCN,GOCONNECT LIMITED,0
> SGN,SINGLETON GROUP LIMITED,1
> AHH,AGRO HOLDINGS LIMITED,1
> ATP,ATLAS PACIFIC LIMITED,1
> AFF,AUSTRALIAN FOOD & FIBRE LIMITED,1
> ASR,AUSTRALIAN RURAL GROUP LIMITED,1
> ARP,ARB CORPORATION LIMITED,2
> ATL,AUTO ENTERPRISES LIMITED,2
> ALO,AUTO GROUP LIMITED,2
> BER,BERKLEE LIMITED,2
> ADB,ADELAIDE BANK LIMITED,3
> ANZ,AUSTRALIA & NEW ZEALAND BANKING GROUP LIMITED,3
> BOQ,BANK OF QUEENSLAND LIMITED.,3
> BWA,BANK OF WESTERN AUSTRALIA LIMITED,3
>
>
> and our Categories are set up so sectors and industires have
> one-to-one relationship with the following (zero-based) numbering
0 -
> "Advertising & Marketing", 1- "Agriculture & Related Services", 2-
> "Automotive & Related Services" and 3- "Banking".
>
> The script for importing the data file will look like this:
>
> /* change this line according to your data file name */
> var filename = "industry_data.txt";
>
> var fso, f, r;
> var ForReading = 1;
> var AmiBroker;
> var fields;
> var stock;
>
> /* Create AmiBroker app object */
> AmiBroker = new ActiveXObject( "Broker.Application" );
>
> /* ... and file system object */
> fso = new ActiveXObject( "Scripting.FileSystemObject" );
>
> /* open ASCII file */
> f = fso.OpenTextFile( filename, ForReading);
>
> /* read the file line by line */
> while ( !f.AtEndOfStream )
> {
>
> r = f.ReadLine();
>
> /* split the lines using comma as a separator */
> fields = r.split(",");
>
> /* add a ticker - this is safe operation, in case that */
> /* ticker already exists, AmiBroker returns existing one */
> stock = AmiBroker.Stocks.Add( fields[ 0 ] );
>
> stock.FullName = fields[ 1 ];
> stock.IndustryID = parseInt( fields[ 2 ] );
>
>
> }
>
> /* refresh ticker list and windows */
> AmiBroker.RefreshAll();
>
> The whole thing is just reading the file line by line and assigning
> the fields to properties of stock automation object. It's so simple
> :-). The only thing that you might want to change is the name of
the
> file with a data - my example uses "Industry_data.txt" file name
but
> this can be changed according to your naming convention. A complete
> script could be found here and a sample data file is here.
>
> .... and that's all for this week - hope you enjoyed reading "
>
> regards
> Stefan
>
>
> --------------------------------------------------
> ------------------------------
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Jean-Yves" <jean-
yves.casalis@xxxx>
> wrote:
> >
> > Thanks Jason and Stefan but... ;-)
> >
> > My problem is not to create my watch list, I already have it. It
> > contains more than 250 tickers and I want to assign
a "particular"
> > industry to all these (same industry for these 250 stocks).
> > You'll quickly understand that the manual assignment of this
> > industry one by one to each of the 250 stocks using the Edit
> > Properties is a nightmare (especially since I'd like to make the
> > same with two or three other watch lists containing also more
than
> > 200 stocks each !).
> >
> > As for the last idea, I'm not using US stocks, but french ones ;-
)
> >
> > So if anybody else has a better way than doing this one by one,
> he's
> > welcome :-)
> >
> >
> > Thanks again.
> >
> >
> > Regards,
> >
> > Jean-Yves
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "sgfuchs" <sgfuchs@xxxx> wrote:
> > >
> > > You can copy exploration results ( symbols ) directly into a
> > > watchlist. Just mark them and rightclick for the popup menu,
> > choose
> > > copy selected symbols to....
> > >
> > > No need to copy symbols from an exploration list to notepad
first
> !
> > >
> > > Industry assignments - if you use the US stocks database in
AB,
> > > assignments should already be in your system.
> > >
> > > Rightclick on a symbol and choose "information" . The window
> > popping
> > > up will inform you about any assignments.
> > >
> > > This information is stored in AB. Read the manual section
about
> > > working with Sectors and Industries / Database management.
> > >
> > > If you messed up your database
> > > you can read this :
> > > http://www.amibroker.com/docs/ab305.html
> > > and download an exe file USStocksdatabase. This is
selfextracing
> > and
> > > adds a new database to AB which can access via database
setting
> > > files.
> > >
> > > It's the same assignment database as used by Yahoo Finance /
> > Reuters
> > >
> > >
> > > best regards
> > > regards
> > > Stefan
> > > --- In amibroker@xxxxxxxxxxxxxxx, Jason Hart <jhart_1972@xxxx>
> > wrote:
> > > > Jean-Yves,
> > > >
> > > > Have you tried tinkering with the "organize assignments"?
If
> > that
> > > doesn't work a little more involved way would to be run an
> > > exploration on the industry you want, copy & save the
resulting
> > > tickers over to notepad - then from notepad import the results
> > into
> > > the watchlist under symbol --> watchlist --> import-->
> > > >
> > > > Jason
> > > >
> > > > Jean-Yves <jean-yves.casalis@xxxx> wrote:
> > > > Hello,
> > > >
> > > > Is there an easy and fast way to assign a given Industry to
a
> > > whole
> > > > Watch List ?
> > > >
> > > > Thanks !
> > > >
> > > >
> > > >
> > > >
> > > > Check AmiBroker web page at:
> > > > http://www.amibroker.com/
> > > >
> > > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > >
> > > >
> > > > Yahoo! Groups SponsorADVERTISEMENT
> > > >
> > > >
> > > > ---------------------------------
> > > > Yahoo! Groups Links
> > > >
> > > > To visit your group on the web, go to:
> > > > http://groups.yahoo.com/group/amibroker/
> > > >
> > > > To unsubscribe from this group, send an email to:
> > > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > > >
> > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> > > Service.
> > > >
> > > >
> > > >
> > > > ---------------------------------
> > > > Do you Yahoo!?
> > > > New and Improved Yahoo! Mail - Send 10MB messages!
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|