PureBytes Links
Trading Reference Links
|
Jeff,
Here's my two cents...
1) First, get the SectorID and IndustryID for each security in the
scan with a simple call to these functions and construct new
composite symbols from their names. Do not use the integer codes.
Ditch the loops... not needed.
2) Use AddToComposite to accumulate the OHLC's for each security and
add them to the new composite names constructed from the Sector and
Industry Group names. In your case, I guess you would replace the "C"
field with the QRS values.
3) Count the number of securities by adding "1" to the "I" field of
each composite. This running count should be the same for all bars.
4) Store the composites in Group 252 using CategoryAddSymbol.
5) Set your AA filter to Group 252 so that the next scan sees your
new composites.
6) In a second scan, calculate the average using the EndBar open
interest value as the total count for each Industry Group or Sector.
7) Add these averages to a new set of composites in Group 253 with
AddToComposite.
I'm not really sure compositing QRS like this is really going to buy
you anything but I'd be interested in hearing what comes of this.
All the best,
-- John
On Apr 27, 2006, at 11:23 PM, fatboycato wrote:
> Once again, I turn to the smart people on this forum for help. I
> have code (from here) that creates composites of sectors and
> industries. I would like to also include a chart of the QuotesPlus
> QRS reading on a sector and industry basis. I thought it would be as
> easy as including a couple lines like: QRS=GetExtraData("QRS");
> AddToComposite(QRS,"mySecName","QRS");. Then I realized that
> C,O,H,L,I, and X are the only fields available for ATC. So, I tried
> putting in AddToComposite(QRS,"mySecName","I"); but that didn't work
> either. I think it's a problem in the GetExtraData() call in that
> it's not getting the QRS for each stock and storing it in the "I"
> field.
>
> As I thought about it more, I realized that just having the
> cummulative QRS for each stock in the composite is going to be
> meaningless since it should probably be an average. In that case,
> I'm going to need to calculate just how many stocks are in each
> sector/industry. That probably won't be a problem, but suggestions
> would be nice.
>
> My code is below since my explanations are rarely very clear. Any
> help would be much appreciated. Even if it's just to give me
> something more to think about.
>
> // use this in scan to calculate the composites for all sectors
> SetBarsRequired(500,0);
> QRS=GetExtraData("QRS");
>
> for(a = 1; a < 40; ++a)
> {
> Filter = SectorID(0) == a;
> secnam = "~Sec~" + SectorID(1);
> AddToComposite( C , secnam, "C");
> AddToComposite( O , secnam, "O");
> AddToComposite( H , secnam, "H");
> AddToComposite( L , secnam, "L");
> AddToComposite( V/1000 , secnam, "V");
> AddToComposite(QRS,secnam,"I");
> Buy = 0;
> }
>
> for(a = 1; a < 110; ++a)
> {
> Filter = IndustryID(0) == a;
> indnam = "~Ind~" + IndustryID(1);
> AddToComposite( C , indnam, "C");
> AddToComposite( O , indnam, "O");
> AddToComposite( H , indnam, "H");
> AddToComposite( L , indnam, "L");
> AddToComposite( V/1000 , indnam, "V");
> Buy = 0;
> }
>
> I've also tried putting the GetExtraData() call inside the for
> loops. In the end, a graphical representation of the composite QRS
> wouldn't be all that necessary (though nice). I would only need to
> reference the QRS in explorations on the composites.
>
> Thank you, in advance.
>
> Jeff
------------------------ Yahoo! Groups Sponsor --------------------~-->
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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
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/
|