Hi Anthony,
Thanks for posting this example code. I will try to get
to it as soon
as possible and will let you know how it turns out.
I
guess it is time to roll up my sleeves and learn the Add To
Composite
feature.
Dave
--- In amibroker@xxxxxxxxxps.com,
"Anthony Faragasso" <ajf1111@xxx> wrote:
>
> Here is
something I have used....was written awhile back.....
>
>
//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:
Phsst
> To: amibroker@xxxxxxxxxps.com
> Sent: Friday, January 04, 2008 9:59 PM
> Subject: [amibroker]
Re: Running scans just to count conditions
>
>
>
>
> How about using AddtoComposite function?
>
> That has always
been TJ's position.
>
> But from my perspective, using ATC for
simple "Counting" functionality
> when I want to do quick counts of
various conditions that exist within
> a Watchlist or Group is usually
more trouble or effort that I am
> willing make where ATC's are
concerned.
>
> Why not simply add a new variable type that is
initialized with each
> execution of an Explore and then 'persists'
throughout the execution
> of the entire Explore so that you can display
the various Counts of
> whatever you want without having to use the more
complex Composite
route?
>
> Maybe there is something too
complex about establishing a new variable
> type of this nature in AB
that I don't comprehend... and then
maybe not.
>
>
>
>
>
>
>
----------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by
AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.17.13/1209 -
Release Date:
1/4/2008 12:05 PM
>