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: [email protected]
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