Custom Universe - Rating Workaround

I’ve been digging around the forums and think I’ve pieced together what I’m trying to do. The goal is to set a custom universe that only includes the blended avg of the top quartile in price to sales and ev to ebitda. Without being able to use the rating function this is kind of tricky for a novice on the platform. Here is the code I’ve written:

SetVar(@rank1, FRank(“$EVtoEBITDA”))
SetVar(@rank2, FRank(“Pr2SalesTTM”))
setvar(@AvgRank,Avg(@rank1,@rank2))
@avgrank > 75

Does this look like an appropriate way to do it? Really appreciate the help from the community.

I think I would do it that way, too, with one exception. The default FRank sort order is #DESC. I would change the order to #ASC since lower is better for the metrics you chose;

SetVar(@rank1, FRank("$EVtoEBITDA",#All,#Asc))
SetVar(@rank2, FRank("Pr2SalesTTM",#All,#Asc))

Walter

In a ranking system there’d be an additional ranking. That is, you get the two ranks, then get an average as a raw score and then rank that raw score again. This will give you 25% actually passing, whereas your rules as presented don’t.

Note the change in the third line:

SetVar(@rank1, FRank("EV/EBITDATTM",#All,#Asc))
SetVar(@rank2, FRank("Pr2SalesTTM",#All,#Asc))
SetVar(@AvgRank,FRank("Avg(@rank1,@rank2)"))
@avgrank > 75

EDIT: Walter is also correct. I have changed the above to integrate his catch. Note that there is no further change in the third line.

Paul,

SetVar(@AvgRank,FRank("Avg(@rank1,@rank2)"))

Thanks for that!

Walter

Fantastic - thank you for the help!

Just following up here. I’m utilizing this new universe in a simulation that aims to screen out expensive stocks and buy based on momentum. With very minimal optimization the simulation is at 28% annualized returns with annualized turnover under 150%. Will be turning this live within the next couple of weeks. Thanks again.


Hi Paul

I am receiving an “ERROR: Value not set for temp variable @RankS uid 27582” error. What is wrong with these rules?
SetVar(@RankS, FRank(“Sales%ChgTTM”, #All, #Desc))
SetVar(@RankY, FRank(“Yield5YAvg” , #All, #Desc))
FOrder(“Avg(@RankS, @RankY)”) <= 20

EDIT: I tried this with a custom formula instead, and the error is: “ERROR: Could not find uid 27582 in function FRank – map size is 0”. Hope that helpd to debug.

Thanks
whotookmynickname

These rules work ok, but you have to have them in the first 3 lines of the universe rules.