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

Re: [amibroker] Re: Running scans just to count conditions



PureBytes Links

Trading Reference Links

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
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
__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___