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

[amibroker] One-step top10 complete application



PureBytes Links

Trading Reference Links




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
 
// top10 Exploration and Application<FONT face=Verdana 
size=2>
function<FONT 
face="Times New Roman"> select( listnum )
{
list = GetCategorySymbols<FONT 
face=Verdana size=2>( categoryGroup, listnum 
);
Rank = 0<FONT 
face="Times New Roman">; 
for( i = <FONT 
size=2>0; ( sym = StrExtract<FONT 
size=2>( list, i ) ) != ""<FONT face=Verdana 
size=2>; i++ )
{
C1 = Foreign( sym, <FONT 
size=2>"C" 
);
f=LastValue(<FONT 
size=2>RSIa(C1,14<FONT 
size=2>));
Rank[BarCount-1<FONT 
face=Verdana size=2>-i] = f[i];
}
return<FONT 
face="Times New Roman"> Rank ; 
}
No=254<FONT 
face="Times New Roman">;// replace 254 with your GroupNo
R= Select(No);H0=Select(No);<FONT 
face="Times New Roman">
L1=LastValue(<FONT 
size=2>Cum(1<FONT 
face=Verdana size=2>));<FONT 
face="Times New Roman">
N=101;// the population of the 
database
TOP=10<FONT face=Verdana 
size=2>;// the topX 
calibration<FONT 
face="Times New Roman">
for(K=1<FONT 
face=Verdana size=2>;K<=TOP;K++)
{
H1=LastValue(<FONT 
size=2>HHV<FONT 
face="Times New Roman">(H0,n));
BAR1=LastValue((<FONT 
size=2>ValueWhen(H0==H1,Cum<FONT 
size=2>(1)-<FONT 
size=2>1)));H0[BAR1]=-<FONT 
size=2>10<FONT 
face="Times New Roman">;
}<FONT face=Verdana 
size=2>
ORD=L1-Cum(<FONT 
size=2>1);
// The trading system
Buy=Cross(<FONT 
size=2>StochD(),30<FONT 
size=2>);
Sell=Cross<FONT 
size=2>(StochD(),<FONT 
size=2>70);
E=LastValue<FONT 
size=2>(Equity(<FONT 
size=2>1,0<FONT 
size=2>));
Filter=H0==-10 AND 
ORD==Status(<FONT 
size=2>"STOCKNUM"<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
AddColumn(E,"E"<FONT 
face=Verdana size=2>);
 
The procedure is slower [because of the use of the <FONT 
size=2>GetCategorySymbols() function].
For the 101 stocks with the 922 data [since Jan2000] loaded, a 
PIII/800 needs 16sec .
Dimitris Tsokakis
 
 
 






Yahoo! Groups Sponsor


  ADVERTISEMENT 









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