Returns the percentile rank for each stock based on user specified parameters for the formula, the scope and the sorting direction.
Parameters
scope: how stocks are grouped before ranking (see below)It works like this:
Special cases:
1) Rank within each sector by the ratio of the latest price divided by price 5 bars ago (1 week return)
FRank("Close(0)/Close(5)",#Sector,#DESC)
2) Rank in three groups: stocks that have a yield = 0, yield less than 5%, and yield of 5% or more. Then return the stock in each group with the highest MktCap.
SetVar(@group, Eval(Yield=0, 0, Eval(Yield > 5, 2, 1)))
SetVar(@rank,FRank("MktCap", #GroupVar, #DESC))
@rank=100 // return the biggest stock in each group
Copy and paste the above in the screener's text editor. This produces these stocks in Sept 2024:
For Yield = 0: AMZN
For Yield between 0 and5: AAPL
For Yield > 5: VZ
| Values | Stocks | ETFs | Description |
| #All | Y | Y | Operates on current universe |
| #Previous1 | Y | Y | Operates on the results from previous rules |
| #GroupVar1 | Y | Y | Operates on groups based on value of variable @Group |
| --------------------------- For Stocks Only --------------------------- | |||
| #Sector | Y | Operates within each Sector of current universe | |
| #SubSector | Y | Operates within each SubSector of current universe | |
| #Industry | Y | Operates within each Industry of current universe | |
| #SubIndustry | Y | Operates within each SubIndustry of current universe | |
| --------------------------- For ETFs Only ------------------------------ | |||
| #Family | Y | Operates within each ETF Family | |
| #AssetClass | Y | Operates within each ETF Class | |
| #Region | Y | Operates within each ETF Region | |
| #Country | Y | Operates within each ETF Country | |
| #Method | Y | Operates within each ETF Method | |
| #Style | Y | Operates within each ETF Style | |
| #Size | Y | Operates within each ETF Size | |
| #ETFSector | Y | Operates within each ETF Sector | |