PureBytes Links
Trading Reference Links
|
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!
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/
|