Top 20% of companies by market cap rule

Hi guys,

Is there a way to write a universe rule to get only the largest 20% of companies by market capitalization?

Thanks,

Brad

  1. setVar(@MktCapRank, FRank(“MktCap”, #DESC))
  2. @MktCapRank >= 80

Thanks for your help primus. I tried entering those two rules in and got an error message “ERROR: Invalid criteria in Rule 16. Value #DESC is invalid for the ‘type’ parameter in FRank()”

BTW, I’m in the universe tab as I want to be able to screen and rank test with it as well.

Is there something basic I’m missing? Sorry, I’m new to P123.

I am sorry. I didn’t check my syntax. Try

setVar(@MktCapRank, FRank(“MktCap”, #Previous, #DESC))

This will work in creating screens and custom universes. You can work MktCap into a complex ranking systems, but I don’t see a point of using it as a sole factor in a ranking system.

Hmm, that didn’t work either. I appreciate the help though.

I want to use the rule to eliminate less liquid stocks, so it’s just going to be in my custom universe. Just to be clear.

Thanks

Can you tell what’s not working about it? Where are you trying to use it? Screener? Custom Universe? Ranking System? Custom Series?

When I copy and paste the syntax into a screener, it seems to work fine.

I’m using it in a custom universe. I think I may have found the answer, but not 100% sure.

FRank(“MktCap”,#All,#DESC)>(100-(20))

Looks like it’s what I want but not sure what’s going into the calculation as it’s not 20% of the companies but something else, particularly when i layer on other filters (no financials for example).

brinaudo,

Your formula should be fine. If you add additional filters, you probably end up with less than the top 20% of your original universe.

For example, if you go to
Tools >> Universes >> New >> Stock Universe
you could select the “S&P 500 Index” as your Start Universe.

If you now only apply only this single rule
“FRank(“MktCap”,#All,#DESC)>(100-(20))”
and hit the “Totals” button you end up with around 100 companies, i.e. 20% of the original universe.

Best,
fips

KISS:

Frank(“MktCap”)>=80

If you want to restrict to a certain number, say top 100, can add:
Forder(“MktCap”)<100

Thanks everyone. Very much appreciated.