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

Re: [amibroker] Code help for % stocks at 30 week hi / lo



PureBytes Links

Trading Reference Links

Gary,

Here is a function that works with Watchlists.....( you did not state
whether your tickers are stored in a watchlist )....It returns the % of
stocks making new highs....

This is a first draft....I have not applied the new Timeframe functions....

Load into Indicator builder...

/* note: if given watch list contains lots of symbols

** performance may be poor

*/

Wlist=Param("WatchListNum",0,0,63,1);

function CreatePercentofStocksNewHigh( listnum )

{

// retrive comma-separated list of symbols in watch list

list = GetCategorySymbols( categoryWatchlist, listnum );

NewHigh = 0; // just in case there are no watch list members

for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )

{

f = Foreign( sym, "h" ) > Ref(HHV(Foreign( sym, "h" ),150),-1) ;

if( i == 0 ) NewHigh = f;

else NewHigh = NewHigh + f;

}

return (Newhigh / i)*100; // divide by number of components

}

Plot( CreatePercentofStocksNewHigh( Wlist ), "% of Stocks making New High",
colorGreen );


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 9/1/2003


------------------------ 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/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/