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

Re: [amibroker] counting the number of candidates in scan



PureBytes Links

Trading Reference Links

there was a code put together by a poster DT who unfortunately does
not visit us anymore. This code originally provided the top% of a list
of stocks meeting certain criteria. eg top 10% with highest RSI or
such.
I modified the code slightly to be of use to me, by making it more
flexible in the stock list you select. it was originally written for
just 100 stocks list.

This may help you in how to do what you want. As I said this is not my
original work, I jsut updated it slightly





-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm


//To select the top10 LastValue(RSI()) stocks of the N100 database AND
see their performance in a trading system,
//explore the database for all quotations with
     // modified updated GJK 02 Aug 05
// top10 Exploration and Application
function select( listnum )
{
 global Count;
 Count = 0;
 list = GetCategorySymbols( categoryWatchlist, listnum );
 Rank = 0; 
 for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
 {
  Count = Count+1;
  C1 = Foreign( sym, "C" );
  f = LastValue(RSIa(C1,14));
  Rank[BarCount-1-i] = f[i];
 }
 return Rank ; 
}

No = 23;// replace 254 with your GroupNo
//R = Select(No); 
H0 = Select(No);
L1 = LastValue(Cum(1));
N = Count;// the population of the database
TOP = 5;// the topX calibration
for(K=1;K<=TOP;K++)
{
 H1 = LastValue( HHV(H0, n) );
 BAR1 = LastValue( ( ValueWhen( H0==H1, Cum(1)-1 ) ) );
 H0[BAR1] = -10;
}
ORD = L1-Cum(1);
// The trading system
Buy = Cross( StochD(), 30 );
Sell = Cross( StochD(), 70 );
E = LastValue( Equity(1,0) );
Filter = H0==-10 AND ORD==Status("STOCKNUM");
AddColumn(E,"E");
AddColumn(Count,"count",1);
 
//The procedure is slower [because of the use of the
GetCategorySymbols() function].
//for the 101 stocks with the 922 data [since Jan2000] loaded, a
PIII/800 needs 16sec .

//###########################################################################################


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h35mt77/M=362131.6882500.7825259.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1124080035/A=2889190/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Put more honey in your pocket. (money matters made easy) Welcome to the Sweet Life - brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

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 other support material please check also:
http://www.amibroker.com/support.html

 
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:
    http://docs.yahoo.com/info/terms/