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

[amibroker] The top10 ROC(C,1)



PureBytes Links

Trading Reference Links




Hypothesis : 
*My Nasdaq100 stocks are placed in Group254. 
*They are 101, the 100 stocks and the index ^NDX.
*They are absolutely aligned, they begin from the same date 
and include the same bars.
Question : 
The top10 last day ROCs.
The idea :
I will read the 101 ROC values for the last day and then I 
will place them as the last 101 elements of an artificial array H0.
Then, I will search for the highest value. 
As soon as it is detected and localised in detail, in the very 
next step it will be replaced by -1000 .
In the new search the 2nd highest will be detected 
etc.
There is an internal loop counter to give the rank 
#
A solution :
There is no need for any exploration.
In  indicator builder window paste the 
 
// Top10 ROCs
function naming( listnum,ORdNo ){list = 
GetCategorySymbols( categoryGroup, listnum );for( i = 0; ( sym = StrExtract( 
list, i ) ) != ""; i++ 
){if(i==ORdno){n1=sym;}}return n1 ; } 
function select( listnum ){list = GetCategorySymbols( categoryGroup, 
listnum );Rank = 0; for( i = 0; ( sym = StrExtract( list, i ) ) != ""; 
i++ ){C1 = Foreign( sym, "C" 
);f=LastValue(ROC(C1,1));Rank[BarCount-1-i] = f[i];}return Rank 
; }No=254;// my N100 database is in Group254R= 
Select(No);H0=Select(No);G=0;Plot(H0,"",2,2);G0=0;L1=LastValue(Cum(1));N=101;// 
the population of my databaseTOP=10;// 10 may change from 1 to 
101
Counter=0;Title="Top10 
ROC"+"\n";for(K=1;K<=TOP;K++){H1=LastValue(HHV(H0,n));BAR1=LastValue((ValueWhen(H0==H1,Cum(1)-1)));H0[BAR1]=-1000;Counter=Counter+1;G0[L1-CountER]=-H1;shape=IIf(Counter==1,shapeDigit1,IIf(Counter==2 
,shapeDigit2,IIf(Counter==3 ,shapeDigit3,IIf(Counter==4 
,shapeDigit4,IIf(Counter==5 ,shapeDigit5,IIf(Counter==6 
,shapeDigit6,IIf(Counter==7 ,shapeDigit7,IIf(Counter==8 
,shapeDigit8,IIf(Counter==9 
,shapeDigit9,shapeDigit0)))))))));PlotShapes((Cum(1)==bar1+1)*shape,Counter,0,Graph0,5);Title=Title+WriteVal(Counter,1.0)+")"+WriteVal(H1)+ 
" ["+WriteVal(L1-bar1-1,1.0)+"-"+naming(254,L1-bar1-1)+"]"+ 
"\n";}Plot((Cum(1)>L1-N)*R,"",(H0==-10)*6+1,2);Plot(0,"",1,1);GraphXSpace=3;
 
and you will have all related info.
The ROC magnitudes, for a useful visual outline at a glance, 
the top10 ROCs, the values, the ordinal No of the stocks, the names, 
everything.
The graph and its info is unique, it will remain the same when 
you move from ticker to ticker and will change by the next EOD 
update.
A similar procedure may give the bottom10 stocks.
Ranking questions for an individual stock, indicators arrays 
for individuals or the whole WatchList/Group etc have clear and quick 
solutions
thanks to the great GetCategorySymbols() function. 

The rest is looping tricks of a non-programmer and it is 
better to make an indulgent criticism...
Dimitris Tsokakis






Yahoo! Groups Sponsor


  ADVERTISEMENT<img
src="" width=300 height=250 border=0>  









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:
ROC.gif

Attachment: Description: "Description: GIF image"