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

Re: [amibroker] Re: Rankings Help/Anthony



PureBytes Links

Trading Reference Links





//% of stocks Advancing
Wlist=Param<FONT 
size=2>("WatchListNum"<FONT 
size=2>,0<FONT 
size=2>,0<FONT 
size=2>,63<FONT 
size=2>,1<FONT 
size=2>);
function CreatePercentofStocksAdvancing( listnum )
{
// retrive comma-separated list of symbols in watch list<FONT 
size=2>
list = GetCategorySymbols<FONT 
size=2>( categoryWatchlist, listnum );
Advancers = 0; 
// just in case there are no watch list 
members
for( i = <FONT color=#ff00ff 
size=2>0; ( sym = <FONT color=#0000ff 
size=2>StrExtract( list, i ) ) != <FONT 
color=#ff00ff size=2>""; i++ )
{
f = Foreign( sym, 
"c" ) > 
MA(<FONT 
color=#0000ff size=2>Foreign( sym, <FONT 
color=#ff00ff size=2>"c" ),<FONT color=#ff00ff 
size=2>200);// 
Ref(Foreign( sym, "c" ),-1) ;<FONT color=#800000 
size=2>
if( i == <FONT color=#ff00ff 
size=2>0 ) Advancers = f;<FONT color=#800000 
size=2>
else Advancers = Advancers + f;
}
return (Advancers / i)*<FONT color=#ff00ff 
size=2>100; // divide 
by number of components
}
/////////////////////////////////////////////////////////<FONT 
size=2>
//Function
//% of stocks Declining<FONT color=#800000 
size=2>
function CreatePercentofStocksdeclining( listnum )
{
// retrive comma-separated list of symbols in watch list<FONT 
size=2>
list = GetCategorySymbols<FONT 
size=2>( categoryWatchlist, listnum );
decliners = 0<FONT 
size=2>;
for( j = <FONT color=#ff00ff 
size=2>0; ( sym = <FONT color=#0000ff 
size=2>StrExtract( list, j ) ) != <FONT 
color=#ff00ff size=2>""; j++ )
{
g = Foreign( sym, 
"c" ) < 
MA(<FONT 
color=#0000ff size=2>Foreign( sym, <FONT 
color=#ff00ff size=2>"c" ),<FONT color=#ff00ff 
size=2>200);<FONT color=#ff0000 
size=2>//Ref(Foreign( sym, "c" ),-1) ;<FONT 
color=#800000 size=2>
if( j == <FONT color=#ff00ff 
size=2>0 ) decliners = g;<FONT color=#800000 
size=2>
else decliners = decliners + g;
}
return (decliners / j)*<FONT color=#ff00ff 
size=2>100; // divide 
by number of components
}
Plot( CreatePercentofStocksAdvancing( Wlist ), 
"Watchlist "<FONT 
size=2>+WriteVal<FONT 
size=2>(wlist,1<FONT 
size=2>)+"\n"<FONT 
size=2>+"% of Stocks Above"<FONT 
size=2>,colorGreen,styleLine);
Plot( CreatePercentofStocksdeclining( Wlist ), 
"\n"<FONT 
size=2>+"% of Stocks below"<FONT 
size=2>,colorRed,styleLine );



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












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 the Yahoo! Terms of Service.