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

[amibroker] The top5 of an exploration



PureBytes Links

Trading Reference Links




1. The VHTr transformation
To Explore N100 for the last RSI, select the top5 and see 
their performance to a trading system, run first in AA for all stocks, all 
quotations the
 
// VHTr, Vertical to horizontal transformation, by D. 
Tsokakis, Apr 2003
<FONT 
size=2>x=Status("stocknum");y=LastValue(RSI());z=LastValue(Cum(1))-x;Ry=AddToComposite(IIf(z==Cum(1),y,-1e10),"~RankY","C");Buy=0;Filter=1;AddColumn(Y,"INDICATOR",1.3);AddColumn(x,"STOCKNUM",1.0);
 
An atificial ticker "~RankY" is just created. It is a bit 
peculiar, it has values for the last 101 bars only.[My N100 database has 101 
names, the 100 stocks plus the index ^NDX itself]From left to right, each 
bar of the new array is equal to the exploration result. The 1st is YHOO, the 
last is ^NDX,exactly inversed from the alphabetic sorting in my Symbol tree. 
But, this ticker is a normal array and accepts anyarray treatment. For 
example, we may find the top5 values.Suppose, for the simplicity, that there 
are no equal values* and paste in IB the
 
H0=Foreign("~RankY","C");L1=LastValue(Cum(1));n=101;// 
the population of the 
databaseH1=LastValue(HHV(H0,n));BAR1=LastValue((ValueWhen(H0==H1,Cum(1))));H2=LastValue(HHV(IIf(H0<H1 
,H0,0),n));BAR2=LastValue((ValueWhen(H0==H2 
,Cum(1))));H3=LastValue(HHV(IIf(H0<H1 AND 
H0<H2,H0,0),n));BAR3=LastValue((ValueWhen(H0==H3 
,Cum(1))));H4=LastValue(HHV(IIf(H0<H1 AND H0<H2 AND 
H0<H3,H0,0),n));BAR4=LastValue((ValueWhen(H0==H4 
,Cum(1))));H5=LastValue(HHV(IIf(H0<H1 AND H0<H2 AND H0<H3 AND 
H0<H4,H0,0),n));BAR5=LastValue((ValueWhen(H0==H5 
,Cum(1))));COLOR=IIf(H0==H1 OR H0==H2 OR H0==H3 OR H0==H4 OR 
H0==H5,7,1);Plot(H0,"",COLOR,2);GraphXSpace=3;Title= "[ 
NUM1="+WriteVal(L1-BAR1,1.0)+",H1="+WriteVal(H1,1.2)+"]"+"[ 
NUM2="+WriteVal(L1-BAR2,1.0)+",H2="+WriteVal(H2,1.2)+"]"+"[ 
NUM3="+WriteVal(L1-BAR3,1.0)+",H3="+WriteVal(H3,1.2)+"]"+"[ 
NUM4="+WriteVal(L1-BAR4,1.0)+",H4="+WriteVal(H4,1.2)+"]"+"[ 
NUM5="+WriteVal(L1-BAR5,1.0)+",H5="+WriteVal(H5,1.2)+"]";
 
The top5 values are paited yellow and, in the title, you read 
5 pairs [STOCKNUM,RSI]The #14 [ BRCD ] is the champion with RSI=77.43 and 
the top5 isBRCD, ICOS, SPOT, PCAR, BRCMWe read in IB title the results 
of the exploration [all stocks, n=1 last quotations] of VHTr.
2. The use of the VHTr 
transformation
Explore now all stocks, n=1 last quotations with 
the
 
<FONT 
size=2>X=Status("STOCKNUM");H0=Foreign("~RankY","C");L1=LastValue(Cum(1));n=101;H1=LastValue(HHV(H0,n));BAR1=LastValue((ValueWhen(H0==H1,Cum(1))));H2=LastValue(HHV(IIf(H0<H1 
,H0,0),n));BAR2=LastValue((ValueWhen(H0==H2 
,Cum(1))));H3=LastValue(HHV(IIf(H0<H1 AND 
H0<H2,H0,0),n));BAR3=LastValue((ValueWhen(H0==H3 
,Cum(1))));H4=LastValue(HHV(IIf(H0<H1 AND H0<H2 AND 
H0<H3,H0,0),n));BAR4=LastValue((ValueWhen(H0==H4 
,Cum(1))));H5=LastValue(HHV(IIf(H0<H1 AND H0<H2 AND H0<H3 AND 
H0<H4,H0,0),n));BAR5=LastValue((ValueWhen(H0==H5 
,Cum(1))));Cond=X==L1-bar1 OR X==L1-bar2 OR X==L1-bar3 OR X==L1-bar4 OR 
X==L1-bar5;Buy=Cross(RSI(),35);Sell=Cross(RSI(),65);// THE TRADING 
SYSTEMe=LastValue(Equity());Filter=COND;AddColumn(X,"STOCKNUM",1.0);AddColumn(E,"EQUITY");
 
You will see the final equity value for the top5 
stocks.Dimitris Tsokakis*another set will be posted to treat the 
possibility of equal values in the result list.






Yahoo! Groups Sponsor












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.



Attachment:
RANK.gif

Attachment: Description: "Description: GIF image"