Print Page  
Advanced Functions / Group Summary Statistics
FMedian("formula" [,scope, excl_zero])
Full Description

Returns the summary statistic for each scope for all the stocks in the scope. For example if your scope is #SubSector, all the stocks in the same Sub-Sector will evaluate to the same summary statistic.

Functions

FMedian("formula" [,scope, excl_zero])
Calculate the median value for the formula in each scope.

FCount("formula" [, scope])
Count the number of stocks in each scope where the formula is non 0. To count the number of stocks in a group use a formula like “1”

FSum("formula" [,scope])
Calculates the sum of the formula for all the stocks in each scope

Parameters

formula: any expression 
scope: determines how stocks are grouped before the summary statistic is calculated (see below) 
excl_zero: when set to TRUE, zero values are discarded (handy for factors like Yield). Default is FALSE 

Examples

1) Find stocks with market caps higher than industry median 

MktCap > FMedian("MktCap",#Industry) 

2) Find stocks with PE's less than the SP500 Median PE 

PEExclXorTTM < FMedian("PEExclXorTTM ",#SP500) 
 

3) Set the reserved @group variable to three distinct values for a) stocks that have a yield = 0 b) stocks with yield less than 5%, and c) stocks with yield of 5% or more. Then screen for stocks that have a MktCap less than the group's median.

ShowVar(@group, Eval(Yield=0, 0, Eval(Yield > 5, 2, 1))) 
ShowVar(@groupMedianCap, FMedian("MktCap", #GroupVar))
MktCap < @groupMedianCap

Copy and paste the above in the screener's text editor to see the results.


Scope Parameter


Values Stocks ETFs Description
#AllYYOperates on current universe
#Previous1YYOperates on the results from previous rule
#GroupVar2YYOperates on groups based on value of variable @Group
--------------------------- For Stocks Only ---------------------------
#SP500YOperates within the SP500 universe
#SectorYOperates within each Sector of current universe
#SubSectorYOperates within each SubSector of current universe
#IndustryYOperates within each Industry of current universe
#SubIndustryYOperates within each SubIndustry of current universe
--------------------------- For ETFs Only ------------------------------
#FamilyYOperates within each ETF Family
#AssetClassYOperates within each ETF Class
#RegionYOperates within each ETF Region
#CountryYOperates within each ETF Country
#MethodYOperates within each ETF Method
#StyleYOperates within each ETF Style
#SizeYOperates within each ETF Size
#ETFSectorYOperates within each ETF Sector
1Available only in the Screener and Custom Universe
2Not available in Ranking Systems