RealTest User Guide
RealTest User Guide

 

 

Navigation: Realtest Script Language > Syntax Element Details >

#DenseRank

 

 

 

 

Category

Cross-Sectional Functions

Description

For each date, evaluates a formula and then calculates the dense rank of each symbol's value among all symbols on that date. Lowest rank (1) means highest value. Identical values get the same rank number.

Example

This first calculates a sector score as the average 20-day return of the symbols in that sector. All symbols in the same sector will have the same score. #DenseRank is then used to assign sector ranks to each symbol starting with 1 for the top sector, 2 for the next sector, etc. This makes it possible to determine e.g. the top stock from each of the top 5 sectors using a custom scoring factor.

Notes

If the formula result is nan (not a number -- unable to calculate) then that stock is not included in the ranking list (reducing the total count) and its rank value would be nan as well.

If the formula result is the same for two symbols then they both get the same rank number. Use #Rank if you want every symbol to have a unique rank number.

 

 

 

Copyright © 2020-2024 Systematic Solutions, LLC