PureBytes Links
Trading Reference Links
|
Hi Graham,
Thanks for the reply. That didn't seem to do what I wanted it to do,
but it gave me a couple of ideas. This code here almost works the
way I want it to:
//-----------------------------------------------
list = GetCategorySymbols( categoryIndustry, IndustryID(0) );
sym = StrExtract( list, 0 );
price = Foreign( sym, "Close" );
m = IIf(price!=0,1,0);
for( i = 1; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
price = Foreign( sym, "Close" );
n=IIf(price!=0,1,0);
m=m+n;
}
Plot(m,"# of Comp's",colorBlue);
//-----------------------------------------------
The only problem with it is it seems to make the count valid in time
only back as far as the "youngest" ticker symbol. Try it on a 2
member group with one stock active for a short period of time and
the other longer. I was using the new issue ticker FORM as
the 'young gun' and SWIR as the older ticker. FORM IPO'd on July
16th. I'd like to see a step change in 'm' on the 16th from 1 to 2.
Any thoughts on how to get this to work out?
Thanks for your help.
-ace
--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> Try this in place of the IIF
>
> If( C[i]>0 && C[i]!=null )
> { n=n+1 }
> Else
> { n=n }
>
>
>
> Cheers,
> Graham
> http://groups.msn.com/asxsharetrading
> http://groups.msn.com/fmsaustralia
>
> -----Original Message-----
> From: acesheet [mailto:acesheet@x...]
> Sent: Sunday, 7 December 2003 12:22 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Counting number of Stocks in an industry
group vs. time
>
>
> Hi folks,
>
> I have a routine that sets up an OHLCV set of arrays for my
Industry
> Groups - code is below. This calculates very well most of the
time.
> However, if there is a stock that is a relatively new issue with a
> substantially different price than those in the index, like a
> averaging $100 stock and $10 ten I get a gap that I wish I didn't
> have in the industry index. This can also happen if I don't have
the
> same length of price history for all the stocks in the group.
>
> What I would like to do is count the number of stocks in the
> industry that actually have a closing price of NOT Null or Close
not
> equal to zero. I thought this expression would do it, but it
doesn't
> work:
>
> list = GetCategorySymbols( categoryIndustry, IndustryID(0) );
> n = 0;
> for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> {
> n=IIf(C>0 OR C!=Null,1,0)+n;
> }
>
> Plot(n,"# of Comp's",colorBlue);
>
> My goal was to look for step changes in the value of 'n' and then
> apply a scale factor of Open/Ref(Close,1) to all the prices
forward
> of the step change, thus correcting the composite index for
> additions of stocks at various times due to differing lengths
> historical data.
>
> Any thougths on how I might accomlish this? I really thought I had
> it there.
>
> Sincerely,
>
> -ace
>
> ------------------------------------------------
> //INDUSTRY GROUP COMPOSITE INDEX CODE
> ------------------------------------------------
> function CreateIndustryAverage( listnum, price )
> {
> // retrive comma-separated list of symbols in watch list
> list = GetCategorySymbols( categoryIndustry, listnum );
> scalefactor=1;
> Average = 0; // just in case there are no watch list members
>
> for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> {
> f = Nz(Foreign( sym, price ));
> if( i == 0 ) Average = Average;
> else Average = Average + f*scalefactor;
> }
> // divide by number of components
> // return Cum(Average / i);
> return Average / i;
> }
> indticker="~"+IndustryID(1);
> //price=CreateIndustryAverage( IndustryID(0) );
> /*StrLeft(IndustryID(1),3)+StrRight(IndustryID(1),3);*/
> IO=CreateIndustryAverage( IndustryID(0), "O" )*10;
IH=CreateIndustryAverage(
> IndustryID(0), "H" )*10; IL=CreateIndustryAverage( IndustryID
(0), "L" )*10;
> IC=CreateIndustryAverage( IndustryID(0), "C" )*10;
> AddToComposite(IO,indticker,"O", 3); AddToComposite
(IH,indticker,"H", 3);
> AddToComposite(IL,indticker,"L", 3); AddToComposite
(IC,indticker,"C", 3);
> AddToComposite(CreateIndustryAverage( IndustryID(0), "V" )
> *10,indticker,"V", 3); AddToComposite( 1, indticker, "I" );
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
-~--> Buy
> Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer
> at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
> http://www.c1tracking.com/l.asp?cid=5511
> http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
> -------------------------------------------------------------------
--~->
>
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|