Allan:  I am not sure this will help you, but I will summarize my approach to this, again, FWIW.  It seems to work for me, and I am sure there are other ways to do it.  I should also say I, like many others, am a "code grabber", in that I seldom am smart enough to come up with some of the creative ideas like others do, but I am not proud to grab these and modify slightly to meet my needs.
 
I have an AFL with various sections in it, and I control what areas of the database are "looked at" by using IndustryID() and in a different section InWatchlist.
 
I scan all symbols and the first loop (in the code) is set to scan IndustryIDs from 1 to 216.  I make a symbol out of the loop index and some letters and then use CategoryGetName(categoryIndustry) to attach a name. I sum closes, and since I am less interested in the Price O/H/L, I stick other ATCs into the composite O/H/L fields (say for example whether the stock was an advancer or a decliner.
 
The other important aspect is where you stick the resulting ATC---I use

CategoryAddSymbol(Sym, categoryWatchlist, TargetWLNbr);

and stick these in a Watchlist named for Industry Composites.
 
After this loop completes, the code falls into another loop which looks at watchlists which have specialized stocks in each of them (a Technology Index, an Emerging Bond index, etc.  This proceeds as I described above with results being put in another watchlist.
 
When I click thru the symbols representing the composites of the industries, everything plots fine.
 
Here are some code snippits as examples.
 
Dan Clark (you should search for past messages by Dan in the yahoo search box and look at the many examples he has posted--excellent learning and good to grab and use) put together this procedure which is at the head of my code:
 
 

Filter=1;

AB = CreateStaticObject("Broker.Application");

//Procedure to add to Composite values

procedure CompositeLoad(Sym, SymName, CloseVal, OpenVal, HighVal, LowVal, VolVal,

OpenIntVal, ATCFlags, TargetWLNbr)

{

//Add To Composite

AddToComposite(CloseVal, Sym, "C", ATCFlags);

AddToComposite(OpenVal, Sym, "O", ATCFlags);

AddToComposite(HighVal, Sym, "H", ATCFlags);

AddToComposite(LowVal, Sym, "L", ATCFlags);

AddToComposite(VolVal, Sym, "V", ATCFlags);

AddToComposite(OpenIntVal, Sym, "I", ATCFlags);

//Modify Names

cs = AB.Stocks(Sym) ;

cs.FullName = SymName ;

// Add to Watchlists

if (TargetWLNbr != 0)

CategoryAddSymbol(Sym, categoryWatchlist, TargetWLNbr);

}

 
A portion of the code that looks at my QP3 industries is this:
 

//AddToCompositeFlags

atcCurrentFlags = atcFlagDeleteValues + atcFlagCompositeGroup + atcFlagEnableInExplore;

//Load composite symbols and add to watchlist

NumOfIndustry = 216; // or the actual number (max 256)

for(w=1;w<NumOfIndustry;w++) // note that the loop starts from 0, not 1

{

if(IndustryID() == w)

{

if(w<10) Sym = "~Z00"+w;

if(w>9 AND w<100) Sym = "~Z0"+w;

if(w>99) Sym = "~Z"+w;

SymName = CategoryGetName(categoryIndustry,w);

//CompositeLoad(Sym, SymName, CloseVal, OpenVal, HighVal, LowVal, VolVal, OpenIntVal, ATCFlags, TargetWLNbr)

CompositeLoad(Sym, SymName, C, 0,0,0,0, 1, atcCurrentFlags, 9);   //<<<<<<<<<<saves results in Watchlist 9

 
 
 
 
Because I mentioned that I stick the count in OI, my plot statements are like that I showed you in a previous message
 
Price = C/IIf(OI=0,1,OI);
Plot(Price,".........etc
 
Maybe these code snippits will give you some ideas and help get you started....

Ken
 
 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, September 12, 2006 1:38 PM
To: [email protected]
Subject: Re: [amibroker] ATC,Sectors and Industries

Tomasz,
I fully recognise the excellence and complexity of your program,but your manual does not do the program justice and the lack of phone support does not make things easier..I apologise if you do not see it that way,but in my 23 years as a Managing Director at Salomon Bros,Smith Barney and Nomura I have had to work with many a users manual and crazy salespeople/customers.Its more of a compliment to your product....Take it for what its worth.
 
You were correct in that I was not scanning upon the whole database.The composites now created in group 253 all have have OHLC and V.I do have a fully populated "Undefined" group consisting of indicies and preferred stocks.I assume anything not in the QuotesPlus sectors gets placed in Undefined when you run the Scan..is that correct??If i delete the undefined list,will it delete all the stocks in it as well??
 
As for the composites created in Group 253,the price is as I expected,and a count divisor is necessary.I can only assume that i have to divide each feild by the count,with the exception of volume and run the scan.Is that correct?
 
Also,I still have no idea if the sectors and groups in Sector can be charted.I now have the correct setup,but still cant chart the sector and industry.Does that have to be done within groups?This is what i am talking about.A clear step by step example would go a long way.

__._,_.___

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 other support material please check also:
http://www.amibroker.com/support.html






SPONSORED LINKS
Software support Small business finance Business finance online
Business finance training Business finance course

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to