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

RE: [amibroker] Re: Bugged out (1) - RANK()



PureBytes Links

Trading Reference Links




Here 
are two functions that should jump-start your efforts;
<SPAN 
class=812181719-26052003> 
<FONT 
color=#008000 size=1>
//walt Schwarz May 2003
// sort & rank functions
// beta 4.38 and up...
/<FONT face="Courier New" color=#008000 
size=1>/*****************************/<FONT face="Courier New" 
color=#800000 size=1>
function 
sort(inlist)
{
//sort 
inlist
temp=0<FONT 
face="Courier New" size=1>;
for<FONT 
face="Courier New" size=1>(i = BarCount-<FONT face="Courier New" 
color=#ff00ff size=1>1; 
i>=0<FONT 
face="Courier New" size=1>; i--)
{
for<FONT 
face="Courier New" size=1> (j = <FONT face="Courier New" color=#ff00ff 
size=1>1; j <= i; j++)
{
if<FONT 
face="Courier New" size=1> (inlist[j-<FONT face="Courier New" 
color=#ff00ff size=1>1] > 
inlist[j])
{
temp = inlist[j-<FONT face="Courier New" color=#ff00ff 
size=1>1];
inlist[j-1<FONT 
face="Courier New" size=1>] = inlist[j];
inlist[j] = temp;
}
}
}
//nlist now 
sorted
<FONT face="Courier New" color=#800000 
size=1>return inlist;
}
/<FONT face="Courier New" color=#008000 
size=1>/*****************************************/<FONT 
face="Courier New" color=#800000 size=1>
function 
rankIt(rankItem,inlist)
{
//see where 
rankItem fits…
rank=0<FONT 
face="Courier New" size=1>;
for<FONT 
face="Courier New" size=1>(i = BarCount-<FONT face="Courier New" 
color=#ff00ff size=1>1; 
i>=0<FONT 
face="Courier New" size=1>; i--)
{
if<FONT 
face="Courier New" size=1>(rankItem > inlist[i] )
{
rank=i; 
i=-1<FONT 
face="Courier New" size=1>;
}
}
<FONT face="Courier New" color=#800000 
size=1>return 
rank/BarCount*<FONT face="Courier New" color=#ff00ff 
size=1>100;
}
//********************************************/<FONT 
face="Courier New" size=1>
//sort the Values...
sz=sort(C);
//find where an item is ranked...
item=2<FONT 
face="Courier New" size=1>;
rank=rankIt(item,sz);<FONT face="Courier New" color=#0000ff 
size=1>
Plot(sz,<FONT 
face="Courier New" color=#ff00ff size=1>"sort"<FONT face="Courier New" 
size=1>,colorRed);<FONT 
face="Courier New" color=#0000ff size=1>
Plot(rank,<FONT 
face="Courier New" color=#ff00ff size=1>"rank"<FONT face="Courier New" 
size=1><FONT 
color=#000000>,colorBlue);

  <FONT face=Tahoma 
  size=2>-----Original Message-----From: rlb21079 
  [mailto:rlb21079@xxxxxxxxxx]Sent: Monday, May 26, 2003 1:58 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re: 
  Bugged out (1) - RANK()Thanks for the tips.  I 
  have read the Users Guide twice and have searched it for specifics 
  often.  The ROC() is a useful funtion, but right now will not be of 
  much use.  My problem biggest problem has been my inability to 
  compare one ticker to another, or more specifically one ticker's volume to 
  the volume of all other tickers in a market.  This seems to be the 
  essential aspect to creating a ranking of stocks, as per volume, change in 
  price, ROC(), or whatever.  There doesn't seem to be a function like 
  say RANK(), the parameters of which might be: "Ticker for comparison," 
  "Group/Market/Watchlist for comparing," "Array to compare"There, 
  of course, could be many variations on a function such as this and I 
  haven't thought them through - but it would be useful.It would allow 
  for the creation of Composite Tickers based on such popular measures as 
  Most Active per Volume, per percentage change, per percentage increase in 
  volume, etc.Thankyou for your time,-Rich--- In 
  amibroker@xxxxxxxxxxxxxxx, Udo.Harke@xxxx wrote:> Rich,> 
  > maybe you should devise a selection of those particular stocks 
  based on the AFL library function ROC() by comparing today's progress 
  ( > 0) versus the preceding day's change of price (> 0 too) 
  expressed as percentage?> > Some information about this 
  function is also contained in the User's Guide which is a companion 
  product issued with AmiBroker!> > Best regards,> > 
  Udo> >   -----Ursprüngliche Nachricht----- 
  >   Von: rlb21079 >   An: 
  amibroker@xxxxxxxxxxxxxxx >   Gesendet: Sonntag, den 25. Mai 
  2003 22:58 Uhr>   Betreff: [amibroker] Re: Bugged out 
  (1)> > >   I'm very sorry to all reading my 
  previous posts.  Esp. Tomasz.  I >   wanted to 
  create a composite ticker holding each day a single value 
  >   comprised of the sum of the direction of change for the 
  15 most >   active stocks of that given day.  If the 15 
  most actively traded >   stocks were all positive, then value 
  would be +15, if all but one >   then value would be 
  +13...etc.  I inteded the requirement of the >   
  rangefrom and rangeto dates to be the same b/c I figured I needed to 
  >   run the explore once for every day I wanted to calculate 
  the number.  >   The code wasn't done, this was just 
  the first couple steps to isolate >   the 15 most 
  actives, but I really can't figure any other way.  I'll 
  >   get more practice with something easier and hopefully be 
  able to do >   this later.>   All the 
  best,>   Rich> > > > 
  >         Yahoo! Groups Sponsor 
  >        
  >        > 
  >   Send BUG REPORTS to bugs@xxxx>   Send 
  SUGGESTIONS to suggest@xxxx>   
  ----------------------------------------->   Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
  >   (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)>   
  -------------------------------------------->   Check group 
  FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  > >   Your use of Yahoo! Groups is subject to the 
  Yahoo! Terms of Service.Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







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.