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

[amibroker] Re: Greybeard Topic - Sorting and Ranking Arrays



PureBytes Links

Trading Reference Links

Ok - I understand the RANK function in Excel.  So, let's say you have
3 columns - Column 1 - Stochastic, Column 2 - RSI, Column 3 will hold
the sum of the two.  You want to Rank Column 1 to find the order of
the positions, then Rank Column 2 to find the order of that column. 
Then, finally, add the columns in order - so add the #1 rank from
column 1, and the #1 rank from column 2, add the #2 rank from column 1
and the #2 rank from column 2, etc.

Am I interpreting this correctly?

--- In amibroker@xxxxxxxxxxxxxxx, Ken Close <ken45140@xxx> wrote:
>
> Droskill:    Thanks for your suggestion.  I did not explain exactly
what I
> am trying to accomplish, so this is a little away from my objective.
> 
> As I put in another reply (to Tomasz) on this subject, 
> 
> "What I need to achieve is equivalent to using the Excel Function RANK,
> which allows the specification of a Range (a column for say,
stochastics for
> 100 funds), then getting in another column the Ordinal Position of that
> ticker relative to all others for the result of stochastics.  Then,
another
> column might have an indicator, say RSI14, and another column using RANK
> that shows the Ordinal Position of each RSI value for all tickers. 
I then
> take a final column and say, sum the two ordinal values for each
ticker to
> get a Master Ranking column.  My situation is more complex than this
(more
> columns and a more complex combining method) but this is the basic idea.
>  
> This can all be done in Excel, but a tremendous labor saving step is to
> accomplish it all in AB.  Imagine trying to do this on 1000s of
stocks on a
> daily or even hourly basis."
> 
> Thus, I am left with trying to manipulate the various columns,
perhaps with
> an ATC for each column, but the looping I envision will be necessary
will
> likely make this kind of an approach too slow.
> 
> Another way to get to a master ranking of ordinal positions of two
or more
> indicators is to take each indicator and multiply them together for each
> ticker (RSI times stochastics times etc) and use the overall product
as a
> ranking "score".  However, the Ordinal Position for each intermediate
> indicator has appeal in a display that others look at, even as all
issues
> are sorted by this so-called MasterRanking parameter.  Thus this
> multiplication route, while it "might" work, loses some
functionality from
> the overall output.
> 
> I appreciate you making the suggestion.  Any other ideas?
> 
> Ken 
> 
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of droskill
> Sent: Friday, May 09, 2008 5:19 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Greybeard Topic - Sorting and Ranking Arrays
> 
> I'll take a different tact - let me assume you just want to display the
> ranking on the screen rather than a backtest - so that's an Exploration.
> 
> Here's quick sample Exploration - I'm not saying there is any value
to these
> measurements - they are for demonstration only.
> 
> MAShort = MA (C,20);
> MALong = MA (C,100);
> PS = ROC(C,250);
> MAps = MA(PS,50); //Do a calculation based on another number
> 
> BuySignal = MAShort > MALong;
> SellSignal = MAShort < MALong;
> 
> Filter = Status("lastbarinrange"); //Filter to only show last bar
AddColumn(
> BuySignal,"Buy"); AddColumn( SellSignal,"Sell"); AddColumn( C, "Close");
> AddColumn( MAShort,"MAShort"); AddColumn( MALong,"MALong"); AddColumn(
> PS,"PositionScore"); AddColumn( MAps,"MA of PS");
SetSortColumns(-3); //this
> sets the sorting column
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Ken Close" <ken45140@> wrote:
> >
> > It has been fun to search the yahoo archives back to 2002 and see
> names of a
> > lot of the original folks who got on the Amibroker bandwagon back in 
> > the early days, many of whom are no longer around (at least not 
> > posting like they used to).  Boy, how the program has evolved and 
> > improved over these many years.
> >  
> > I was looking back there in the archives for messages on the Osaka
> Plugin
> > (which is still on my hard drive since 2002 but which I have never
> used).
> > Maybe now......
> >  
> > I have a need to take a watchlist and position rank several
columns of 
> > calculations and determine the postion rank of the ticker for that 
> > calculation; then do the same for another column (calculation), get 
> > the position rank for that additional column, and then combine the 
> > position ranking numbers for the columns for each ticker, sort of to 
> > get a Master ranking parameter.
> >  
> > My question is: what new features in AB might help accomplish this?
>  Surely
> > the Osaka Plugin (2002 vintage) is not the only way to do what I
> want.  I
> > have not really studied nor used Static and Dynamic variables---is
> this the
> > set of commands that I would use with looping to get position
ranks of 
> > a watchlist?
> >  
> > I did find and just tested some code from the Library which used
> just these
> > tools (variables and looping) and it was painfully slow and would
> not really
> > work for the application I have in mind.  I am uncertain if the code
> in that
> > example can be modified to make it faster. 
> >  
> > Any suggestions about this age-old question/problem, given the many
> advances
> > of Amibroker since 2002??
> >  
> > Thanks for any ideas (the more specific the better).
> >  
> > Ken
> >
> 
> 
> 
> ------------------------------------
> 
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
> 
> 
> 
> No virus found in this incoming message.
> Checked by AVG. 
> Version: 8.0.100 / Virus Database: 269.23.14/1425 - Release Date:
5/9/2008
> 12:38 PM
>



------------------------------------

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/