Your help with FMedian

For a buy rule I would like the company to be part of an industry that is in the top half of all industry ProjPENextFY medians, based on companies that have at least #AnalystsNextFY>2. Is this possible to accomplish with P123?

I am struggling to get this working with functions and parameters like FRank, FMedian, #Groupvar, #Industry, e.g.:
SetVar(@Group,AnalystsNextFY>2)
FRank(“FMedian(“ProjPENextFY”,#Groupvar AND #Industry)”)>50

Your help is greatly appreciated. Thanks in advance!

HedgeHog - you will need to put the number of analysts in a custom universe. I can’t see any way around it.

I tried to use a variable and also custom function but I was unable to accommodate FRank(“FMedian(”…").

The solution appears to be creation of a rating system (i.e. ranking system) with one node: FMedian(“ProjPENextFY”,#Industry). In this example I called the RS “FM”.

Then in the sim, use the buy rule: Rating(“FM”)>50

I have created an example:

https://www.portfolio123.com/app/ranking-system/227939
https://www.portfolio123.com/port_summary.jsp?portid=1194977

I think this should do what you want but no guarantees! I didn’t do the custom universe part…

Steve

Thank you Steve, I created a custom universe. Your solution seems to do the trick as #Industry ranks within Industries in selected universe.

I hoped this could be achieved without having to create a new rating system and universe, but I guess this is the only way.

Just to be explicit, the problem with combining these functions is that you can’t nest quoted strings. That’s a general rule on P123, and applies to any function that takes a quoted string.

Paul - I used to be able to put one of the functions with quotes in a custom function, then embed the custom function within the second set of quotes. This used to work. But it gives me an error now at least in this particular instance.
Steve