[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Strange subscript out of range



PureBytes Links

Trading Reference Links

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@xxxxxxxxxxxx>
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 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/
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 1/8/2004


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/