# Equities Lab Operators

To find out more, read our Operators Overview

## as of

X as_of n days ago
The As Of operator allows you retrieve a value as of X trading days ago. So Net Income as of 251 trading days ago(1 year) would give you the previous year’s net income.
 Close as of 8.0 days ago < Close

## future

X in the future n days
The future operator allows you retrieve a value that is X trading days in the future. THIS ONLY WORKS IN THE PAST! Equities Lab CANNOT predict the future! Net Income future 251 trading days(1 year) would give you the next year’s net income. If this were asked in 2010, it would give you 2011’s income. Asked 6 months ago, it gives you Undefined.

## at

X at mm/dd/yyyy
The At Operator returns the value of something on a desired date in the past such as a stock’s yield. (Yield at 01/01/2010)
 Close > (Close at Jan 01 2011)

x / y

## round

x round to nearest multiple y
The Round Operator enables you to round properties or terms to the nearest X. An example would be (Market Cap Round to the nearest 10000).
 (Market_Cap round to nearest multiple of 100000.0)

## round

x round to nearest power of y
The Round Power operator will round any property or term you desire to the nearest power of X. So if you say Round Market Cap to the nearest power of 5 it will segment the market into market cap deciles of 5, 25, 125, 625, 3125, 15,625, 78,125, Etc..
 (Market_Cap round to nearest power of 2.0)

## ×

x * y
The Multiply enables you multiply a value by another value.
 Shares_1Q × Close > 1000.0

## –

x – y
The Subtract operator subtracts a term or field from another.
 Close – (Close as of 3.0 days ago) > 0.0

## **

x ** y
In the notation x**y. Raises property x to the power of y.

## +

x + y
The Plus operator adds together multiple properties or terms together.
 Net_Inc_1Q + Net_Inc_2Q > 0.0

## predict

predict x, y, …
Predict predicts the field named goal_something using the attributes specified. It filters the input set based on the galaxy_something variable, and uses the variable train_something to determine the training set.

## abs

abs x
The Absolute Value Operator returns the absolute value of the term you put into it.
 abs (change of Open over 1.0 days)

## abs

absrat x
The Absolute Ratio Operator returns the absolute ratio of the term you enter into it. Since it is giving a ratio the value will always be over 1. For instance, if a stock lost 5% in a day than the Absolute Ratio of the Close/(Close as of 1 day ago) would be 1.05.
 abs ratio (Close ÷ Open) > 1.02

## sum

sum of X since mm/dd/yyyy
The Sum Since operator takes the sum of a property or term pertaining to a stock since a specified date, meaning it adds the property for each day from the specified date up until the current date.
 sum of Q_Surprise since Sun Jan 01 2012

## sum

sum of X within last n days
The Sum Within operator takes the sum of a property or term pertaining to a stock within X days, meaning it adds the property or term for each day within X trading days up until today. If the stock’s closing price the past 3 days were 5, 6, and 7 then the sum of the closing price within 3 days = 18.
 sum of (Close – Open) within 5.0 days > 0.0

## change

change
The Change Over returns the % change of a value within X trading days, such as Change of Closing price over 21 trading days.
 change of Close over 10.0 days > (change of SPY:Close over 10.0 days)

## if

if cond then A else B
The If will return one of two values: either what is after the “then,” or what is after the “else,” depending on what you put after the “if”. If the condition after the “if” is true, then it returns what you put after the “then”; if it is false, then the operator returns what is after the “else”.
 if (EPS_1Q > 0.0) then (average Close within 25.0 days) else (average Close within 80.0 days) > (average Close within 100.0 days)

## when

X when Y since mm/dd/yyyy
The When Since Operator returns the value of a property or formula while another condition is true, since a certain date.
 change of Close over 10.0 days when (Net_Income_1Q > 0.0) since Tue Jan 01 2013

## when

X when Y within last n days
The When Within Operator returns the value of a property or formula while another condition is true, within X number of days.

## ever

ever X since mm/dd/yyyy
The Ever Since tests if the condition you enter into the operator has ever been true since a date in the past. For instance, has a stock ever had a quarterly surprise greater than 20% since 2010.
 ever ((Volume ÷ (average Volume within 20.0 days)) > 3.0) since Fri Jan 01 2010

## ever

ever X within last n days
The Ever Within operator tests if the condition you enter into the operator has ever been true within X number of trading days. For instance, has a stock ever had a quarterly surprise greater than 20% within 251 trading days.
 ever ((Close ÷ (Close as of 3.0 days ago)) > 1.15) within 10.0 days

## always

always X since mm/dd/yyyy
The Always Since operator tests if a condition is always true since a date in the past. For instance one could check if a company’s sales growth was always positive since 2004.
 always (EPS_1Q > 0.0) since Thu Jan 01 2004

## always

always X within last n days
The Always Within operator tests if a condition is always true within X trading days. For instance, one could check if a company’s sales growth was always positive within 251 trading days.
 always (Close > Open) within 3.0 days

## then

X then Y until Z since mm/dd/yyyy
The Then Since operator enables you to test whether a condition was true after another condition was true until another condition is true since a date in the past.
 Close > (Close as of 2.0 days ago) then (Close > (Close as of 2.0 days ago)) until (Close < (Close as of 2.0 days ago)) since Jan 01 2008

## then

X then Y until Z within last n days
The Then Within operator enables you to test whether a condition was true after another condition was true until another condition is true within X Trading Days.
 Close ÷ (Close as of 3.0 days ago) 0.99 then ((Close ÷ (Close as of 3.0 days ago)) > 1.02) until ((Close ÷ (Close as of 3.0 days ago)) < 1.0) within 10.0 days

## <

x < y
The Less than operator allows you to test whether one term is less than another term.
 Close < (Close as of 3.0 days ago)

## ≤

x ≤ y
The Less than or Equal to allows you to test whether one term is less than or equal to another term.
 Close <= (Close as of 3.0 days ago)

x > y

## =>≥

x ≥ y
The Greater than or equal to allows you to test whether one term is greater than or equal to another term.
 Close >= (Close as of 3.0 days ago)

## and

a and b
The And operator will be used when you want to add more conditions to your stock screener or trading model. You can also click the green + symbol to perform the same operation.
 Match all of the following Net_Inc_T12M > Net_Inc_1Y and Close > (Close as of 5.0 days ago)

## or

a or b
The Or operator enables you to require that a stock passes at least one of X conditions you specify.
 Match any of the following Close > (Close as of 5.0 days ago) or PE > (PE as of 5.0 days ago)

## =

x equals y
The Equals and Not Equals will be used to determine whether two conditions are equal to one another.
 PE > (PE as of 5.0 days ago) = (Market_Cap > (Market_Cap as of 5.0 days ago))

x not equal to y

## not

not x
The Not operator enables you to require that a condition is not true such as not classify as technology.
 not classify Transportation

## logarithm

logarithm of x
Logarithm takes the natural logarithm of a number. Like all logarithms, it will return an undefined value if the input is less than or equal to zero.

## rank

rank of w in (x,y,z…)
The Rank operator returns the rank (0-100) of the property or term pertaining to a stock compared to other property or term pertaining to a stock. For instance, you could find stocks whose current closing price ranks the highest out of its 12, 24, and 50 day moving average.
 rank of Close in (average Close within 5.0 days) (average Close within 12.0 days) =100.0

## rank

rank of X within last n days
The Rank Within operator sorts out all values within N days from least to greatest and puts them in a ranking from 0 to 100. It then allows you to specify where the current value ranks in that order. For instance, you could specify that the stock’s closing price currently ranks in the highest decile compared to its closing prices within 251 trading days.

## rank

rank of X since mm/dd/yyyy
The Rank Since operator sorts out all values since XX/YY/ZZZZ from least to greatest and puts them in a ranking from 0 to 100. It then allows you to specify where the current value ranks in that order. For instance, you could specify that the stock’s closing price currently ranks in the highest decile since 01/01/2014.
 rank Close since Fri Jan 01 2010 > 85.0

## percentile

percentile X within n days
The Percentile-Within operator gives the value of Xth percentile of whichever property you desire within X number of trading days.
Close at the 50th percentile within 100 days would give the 50th highest closing price over that time period.

### Example

Close at the 50th Percentile Within 180 days > Close at the 50th Percentile Within 360 days

## percentile

percentile X since mm/dd/yyyy
The Percentile Since operator would give you the median of the percentile values of a property since a date in the past. If you put 0, it would give you the minimum, and it would give you the maximum if you put 100. It is useful to measure how values are changing over time or to measure where a property value stands in comparison to other property values in the past.

Close at the 90 Percentile since 01/01/2010 < close

#### Stock Screener Example

Close at the 50 Percentile Since 01/01/2010 > close at the 50 Percentile Since 01/01/2008

## covariance

covariance of X with Y since mm/dd/yyyy
Takes the covariance of two properties since a given date. Covariance of x and y is a value with units of x*y, which measures the degree to which y changes when x changes. A positive covariance indicates positive change of x with a positive change of y, and a negative covariance indicates a negative change of x with a positive change of y. Unlike correlation, one covariance value cannot be compared to another due to the different units of each covariance value. As a result, covariance values cannot be used to show relative strength of covariance.

## covariance

covariance of x with Y within last n days
Takes the covariance of 2 variables within X number of days. Covariance of x and y is a value with units of x*y, which measures the degree to which y changes when x changes. A positive covariance indicates positive change of x with a positive change of y, and a negative covariance indicates a negative change of x with a positive change of y. Unlike correlation, one covariance value cannot be compared to another due to the different units of each covariance value. As a result, covariance values cannot be used to show relative strength of covariance.

## correlation

correlation of X with Y since mm/dd/yyyy
Gives the correlation of two properties since a given date. Correlation is a dimensionless value that ranges between -1 and 1, which indicates how closely a change of one property is related to a change in another. 1 is the strongest possible positive correlation, -1 is the strongest possible negative correlation. 0 implies no relationship at all. Because correlation is dimensionless, different correlation values derived from different variables may be compared to one another. For the same reason, one can use different values of correlation to gauge relative strength of correlation.

## correlation

correlation of x with Y within last n days
Gives the correlation of two properties within X trading days. Correlation is a dimensionless value that ranges between -1 and 1, which indicates how closely a change of one property is related to a change in another. 1 is the strongest possible positive correlation, -1 is the strongest possible negative correlation. 0 implies no relationship at all. Because correlation is dimensionless, different correlation values derived from different variables may be compared to one another. For the same reason, one can use different values of correlation to gauge relative strength of correlation.

## zscore

zscore of X since mm/dd/yyyy
zscore since returns the zscore of a value since a specific date. The z-score is the number of standard deviations above or below the mean the given value is. After since in the operator you will specify the date.

## zscore

zscore of X within last n days
The zscore within the last n days. The zscore is the number of standard deviations above or below the mean the given value is, using the values within the given span.

## choose

choose from x to y step z

## choose

choose one of x,y,z
The Choose Set operator enables you test a set of values in a trading model and use the value that gives the best return.
 Close > (Close as of chooseSet days ago) choose-set of 10.0 20.0 28.0

## monte carlo

monte carlo {x,y,z}

## monte carlo

monte carlo x to y

classify as

## ticker

ticker is
The Ticker Is operator allows you to specify a ticker for use in a stock screener or trading model. For instance, ina stock screener you could create a condition that says ” Ticker Is AAPL
 ticker GE

## position

position-across
The Position Across operator returns an integer from 1 to infinity that represents what position the stock is in based on whatever term or property you enter into the operator across any set of stocks such as industry or sector or mid caps. For instance, If you want the top 10 market cap companies in each Industry you will type. ( Position of Market Cap Across Industry where True < 11). After across in the operator you will specify which set of stocks are included, and after where in the operator you will define constraints that a stock must pass in order to be included.
 position of Market_Cap across Ind_3_Dig where ((Close > 0.0) and (Market_Cap > 0.0))

## rank

rank-across
The Rank Across operator returns the rank (0-100%) of the property or term across any set of stocks such as its industry or sector or mid caps. Take the following example:
 rank of PE across Industry where ((MarketCap > 500m))
This will give you the stock’s rank within its own industry, including only stocks with a Market Cap greater than 500m. So if a stock has a P/E in the 33rd percentile it would have a rank of 33.
Try modifying this Stock Screener to give you the top 25% rather than the bottom 25%

## market

market-rank
Ranks stocks according to the percentile value of the given property. For instance, market-rank of market cap > 90 shows all stocks in the 90th percentile of market cap.

## growth

growth of X yearly
Takes a property’s growth, i.e. how much it has increased from one year to the next, over X number of years.

## average

average X yearly
Takes the average of a given property over the past X number of years. For instance, average-yearly of market cap over 2 years will net the average value for market cap over the past 2 years.

## decreasing

decreasing x over n days
Decreasing Over looks for companies whose X variable is decreasing over a time period Y. With the input of the variable that should be decreasing and the time span over which it will decrease, only companies whose X is higher at time 0 than it is at time Y will be returned.
 decreasing Market Cap over 252 days

## increasing

increasing x over n days
Increasing Over X returns those companies whose X has been increasing over so many days. After the increasing over operator you will specify which variable needs to be increasing and set the time frame over which that variable is constrained. Only companies whose X is increasing over those days will show up in the screen.
 increasing Market Cap over 252 days

## percentile

percentile across
Percentile Across gives the value of a term or property at the Nth percentile across any set of stocks including industry or the entire market. After across in the operator you will specify which set of stocks are included, and after where in the operator you will define constraints that a stock must pass in order to be included.
 Net_Inc_Gwth_12M at 50.0 percentile across ((Market_Cap > 1000.0) where ((Market_Cap > 1000.0)

## median

median x across
The Median Across operator returns the median value of what you enter into the operator across a range of stocks inlcluding industry or the entire market. After across in the operator you will specify which set of stocks are included in the calculation, and after where in the operator you will define constraints that a stock must pass in order to be included.
 median of Rel_Strength_MR_T1M across Ind_3_Dig where (Market_Cap > 1000.0)

## min

min-across
The Min Across takes the minimum value across any set of stocks including industry or sector. After across in the operator you will specify which set of stocks are included, and after where in the operator you will define constraints that a stock must pass in order to be included.
 min of Rel_Strength_MR_T1M across Ind_3_Dig where (Market_Cap > 1000.0)

## max

max-across
The Max Across Operator returns the maximum of whatever you enter into the operator across a set of stocks such as the entire market or an industry. After across in the operator you will specify which set of stocks are included, and after where in the operator you will define constraints that a stock must pass in order to be included.
 max of Rel_Strength_MR_T1M across Industry where (Market_Cap > 1000.0)

## total

total-across
The Total Across operator calculates and returns the sum a property or term across an entire set of stocks such as industry or market or etc. After across in the operator you will specify which set of stocks are included, and after where in the operator you will define constraints that a stock must pass in order to be included.
 total of (change of Close over 1.0 days) across (Market_Cap > 10000.0) where (Market_Cap > 10000.0) > 0.0

## average

average X across
Average across returns the average of a value across any set of stocks such as industry, sector, or the entire market. After across in the operator you will specify which set of stocks to have the average calculated on, and after where in the operator you will define constraints that a stock must pass in order to be included in the average.
 (average of Rel_Strength_MR_T1M across Industry where (Market_Cap > 100.0))

## count

count-across
The Count Across operator returns an integer that represents the number of stocks that pass the condition within the operator. After across in the operator you will specify which set of stocks are included, and after where in the operator you will define constraints that a stock must pass in order to be included.
 count of (Close > (Close as of 1.0 days ago)) across (Market_Cap > 500.0) where (Market_Cap > 500.0)

## odds

odds-across
The Odds Across operator returns the percentage odds that a stock within a specified range of stocks passes a condition that you enter into the operator. For example, odds that a stock in the technology sector has greater sales than it did 1Q ago. After across in the operator you will specify which set of stocks are included, and after where in the operator you will define constraints that a stock must pass in order to be included.
 odds of ((average Close within 10.0 days) > (average Close within 21.0 days)) across ((Market_Cap > 1000.0) where ((Market_Cap > 1000.0)

## weighted average

weighted average of PROPERTY

## variance

variance X across
Variance across returns the variance of a value across any set of stocks such as industry, sector, or the entire market. After across in the operator you will specify which set of stocks to have the variance calculated on, and after where in the operator you will define constraints that a stock must pass in order to be included in the variance. Variance measures the spread of values in the dataset; a high variance indicates a great distance between values.

## stddev

stddev X across
Stddev Across returns the standard deviation of a value across any set of stocks such as industry, sector, or the entire market. After across in the operator you will specify which set of stocks to have the standard deviation calculated on, and after where in the operator you will define constraints that a stock must pass in order to be included in the standard deviation.

## skewness

skewness X across
Skewness across returns the skewness of a value across any set of stocks such as industry, sector, or the entire market. After across in the operator you will specify which set of stocks to have the skewness calculated on, and after where in the operator you will define constraints that a stock must pass in order to be included in the skewness. Skewness can be defined as a measure of how positively or negatively-biased a given dataset is from a normal distribution. A skewness of >0 implies a median value greater than the mean (positive bias), and a skewness of <0 implies a median value less than the mean (negative bias).

## zscore

zscore X across
zscore across returns the zscore of a value across any set of stocks such as industry, sector, or the entire market. The z-score is the number of standard deviations above or below the mean the given value is. After across in the operator you will specify which set of stocks to have the zscore calculated on, and after where in the operator you will define constraints that a stock must pass in order to be included in the zscore.

## ema

ema of X over n days
Exponential Moving Averages reduces the lag of a simple Moving Average by applying more weight to recent prices. The weighting applied to the most recent price depends on the number of periods in the moving average.
 ema of Close over 4.0 days

## rank

rank X is in the top y%
Ranks stocks from least to greatest according to a given property, then returns all stocks that score in the top X% of that property.

## rank

rank X is in the bottom y%
Is the rank of a term in the bottom n%?
For example, the following example would be false for a stock with a P/E of 100 and true for stock with P/E of 1.
` rank P/E is in bottom 1% Keywords: rank-bottom quartile`

## backtest

backtest
The Backtest Operator will return a multiple that represents the backtest return since 2003 of whatever term you put in the operator. So Backtest of (Market Cap > 100,000) = 2 means that since 2003, the starting backtest value had doubled which represents a 100% back test return.
 backtest of classify as Technology > (backtest of classify as Technology as of 5.0 days ago)

## stddev

stddev x, y, …
The Stddev Operator returns the population standard deviation of the properties or values you enter into it. Press Control + Shift + A to add another box to add another property or value.
 standard deviation of Close, Open, High, & Low > 0.1

## stddev

stddev X within n days
Stddev Within takes the standard deviation of a value pertaining to a stock within a certain number of trading days, such as yield. (Standard Deviation of yield within 30d).

## stddev

stddev X since mm/dd/yyyy
Stddev Since takes the standard deviation of a value pertaining to a stock since a date in the past, such as yield. (Standard Deviation of yield since 01/01/2010).

## variance

variance x, y, …
The Variance operator returns the population variance of the properties or values you enter into it. Variance measures the spread of values in the dataset; a high variance indicates a great distance between values.
Press Control + Shift + A to add an additional term, or input a comma into the entry box.

## variance

variance X within n days
Returns the population variance of the given property within n trading days. Variance measures the spread of values in the dataset; a high variance indicates a great distance between values.

## variance

variance X since mm/dd/yyyy
Returns the population variance for a given property since a given date. Variance measures the spread of values in the dataset; a high variance indicates a great distance between values.

## min

min x, y, …
The Min operator returns the minimum of a set of terms you enter into it. To add another box you simply press control + Shift + A, or input a comma into the previous box.

## min

min X within n days
The Min Within operator takes the minimum of value that you enter into the operator pertaining to a stock within X trading days such as the minimum closing price within 21 trading days.
 min Close within 180.0 days

## min

min X since mm/dd/yyyy
The Min Since operator takes the minimum of value that you enter into the operator pertaining to a stock since a date in the past such as the minimum closing price since 01/01/2014
 Close ÷ (min Close since Tue Jan 01 EST 2008) > 2.0

## average

average x, y, …
The Average Operator returns the average of the values you input.
To add another value simply press Control + Shift + A.
 average of Sales_Gwth_5Q_to_1Q, Sales_Gwth_6Q_to_2Q, Sales_Gwth_7Q_to_3Q, Sales_Gwth_8Q_to_4Q > 5.0

## average

average X within n days
The Average Within operator returns the average of a value within X number of trading days such as the average closing price within 10 trading days.
 average Close within 4.0 days > (average Close within 9.0 days)

## average

average X since mm/dd/yyyy
Average Since take the average of a value pertaining to a stock since a date in the past such as yield. (Average yield since 01/01/2010)
 Close > (average Close since Tue Jan 01 2008)

## max

max x, y, …
The Max operator returns the maximum of a set of terms you enter into it. To add another box you simply press control + Shift + A, or input a comma into the previous box.

## max

max X within n days
The Max Within operator takes the maximum of value that you enter into the operator pertaining to a stock within X trading days such as the maximum closing price within 21 trading days.
 max Close within 180.0 days

## max

max X since mm/dd/yyyy
The Max Since operator takes the maximum of the value that you enter into the operator pertaining to a stock since a date in the past, such as the maximum closing price since 01/01/2014
 Close ÷ (min Close since Tue Jan 01 EST 2008) > 2.0

## odds

odds of x,y,z…
The Odds operator returns the percentage odds between 0 and 100% to which the values that you enter into the operator are true. If 2 out of the 5 values are true then the odds operator would return 40.
 odds of (Sales_Gwth_12M > 0.0) (Net_Inc_Gwth_12M > 0.0) (Q_Surprise > 0.0) > 50

## odds

odds of X within last n days
The Odds Within operator returns the odds (from 0 to 100) that the stock passes the condition that you enter into the operator within X days. For instance, a stock’s 12 day moving average has been greater than its 24 day moving average 60% of the time within 60 trading days.
 odds (Close > (Close as of 4.0 days ago)) within 28.0 days

## odds

odds of X since mm/dd/yyyy
The Odds Since operator returns the odds (from 0 to 100) that the stock passes the condition that you enter into the operator since a date in the past. For instance, a stock’s 12 day moving average has been greater than its 24 day moving average 60% of the time since 01/01/2014.
 odds (Open > Close) since Fri Jan 01 2010

## count

count of x,y,z…
The Count operator returns an integer that represents the amount of conditions that pass that you entered into the operator.
 count of (Close > average Close within 20.0 days) (Net_Inc_1Q > Net_Inc_2Q) (Sales_1Q > Sales_5Q)

## count

count of X within last n days
The Count Within operator returns an integer that represents the number times the condition that you enter into the operator has been within X number of days. For instance, the operator could tell you how many times a stock has increased over 4% in a day within 50 trading days.
 count (Close > (Close as of 2.0 days ago)) within 10.0 days

## count

count of X since mm/dd/yyyy
Count Since returns an integer that represents the number times the condition that you enter into the operator has been true since a date in the past. For instance, the operator could tell you how many times a stock has increased over 4% in a day since the start of 2014.
 count (Net_Inc_1Q > (Net_Inc_1Q as of 1.0 days ago)) since Fri Jan 01 2010