PureBytes Links
Trading Reference Links
|
Hi,
Would it be possible to add the final value of this to a different
composite please:
perc_Adv=Foreign("~Adv","x")/(Foreign("~Adv","x")+Foreign
("~Decl", "x") ) * 100;
I tried for example this:
----------------8<------------------
adv=C > Ref(C,-1);
decl=C <= Ref(C,-1);
AddToComposite(adv,"~adv","x");
AddToComposite(decl,"~decl","x");
Buy=0;
Perc_Adv=Foreign("~Adv","x")/( Foreign("~Adv","x")+Foreign
("~Decl","x"))*100;
AddToComposite(Perc_Adv,"~Perc_Adv","C");
----------------8<------------------
...but the values do not look right. I also ran the "adv" and "decl"
first, THEN the "Perc_Adv" to make another composite but doesn't look
right either?
Cheers Glenn
--- In amibroker@xxxxxxxxxxxxxxx, "Glenn" <glennokb@xxxx> wrote:
> Anthony,
>
> Excellent!!! Thanks for sharing this.
>
> Cheers Glenn
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso"
> <ajf1111@xxxx> wrote:
> > Glenn,
> >
> > You could create a function and place it in Indicator builder and
see it
> on
> > the fly...without creating the composites....
> >
> > This gives the same percent :
> >
> > adv=C > Ref(C,-1);
> >
> > decl=C <= Ref(C,-1);
> >
> > AddToComposite(adv,"~adv","x");
> >
> > AddToComposite(decl,"~decl","x");
> >
> > Buy=0;
> >
> > perc_Adv = Foreign("~Adv", "x") / ( Foreign("~Adv", "x") + Foreign
> >
> > ("~Decl", "x") ) * 100;
> >
> > Filter=1;
> >
> > AddColumn(perc_adv,"%Adv",1);
> >
> >
> >
> > AS THIS, in Indicator Builder:
> >
> > //Function
> >
> > //% of stocks Advancing
> >
> > Wlist=Param("WatchListNum",0,0,63,1);
> >
> > function CreatePercentofStocksAdvancing( listnum )
> >
> > {
> >
> > // retrive comma-separated list of symbols in watch list
> >
> > list = GetCategorySymbols( categoryWatchlist, listnum );
> >
> > Advancers = 0; // just in case there are no watch list members
> >
> > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> >
> > {
> >
> > f = Foreign( sym, "c" ) > Ref(Foreign( sym, "c" ),-1) ;
> >
> > if( i == 0 ) Advancers = f;
> >
> > else Advancers = Advancers + f;
> >
> > }
> >
> > return (Advancers / i)*100; // divide by number of components
> >
> > }
> >
> > Plot( CreatePercentofStocksAdvancing( Wlist ), "% of Stocks
> Advancing",
> >
> > colorGreen );
> >
> > Anthony
> >
> > ----- Original Message -----
> > From: "Glenn" <glennokb@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Saturday, January 17, 2004 2:35 PM
> > Subject: [amibroker] Percentage Advancers?
> >
> >
> > > Hi,
> > >
> > > I'd like to setup a composite of the % advancers (& decliners
> > > later) ...any idea how please? ie:
> > >
> > > % advancers = advancers / total (active) stocks x 100
> > >
> > > For starters:
> > >
> > > Adv=C>Ref(C,-1);
> > > AddToComposite(Adv,"~Adv","C");
> > >
> > > I need to add to the above the total stocks. Is there a way to
count
> > > them, would you need to run another scan first to get the total
stock
> or
> > > could it be done within one scan?
> > >
> > > Cheers Glenn
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
------------------------ 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
---------------------------------------------------------------------~->
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/
|