Formula Screener
is the most powerful tool we provide in our service.
Whereas regular stock screener applies "and" condition to all selected criteria (i.e. all criteria must be met for a stock to be selected),
the Formula Screener allows you to combine "and", "or" and "not" conditions
to build very specific criteria.
Moreover, the Formula Screener tool gives you the possibility to combine criteria on different time periods.
Other words, it is possible to find stocks that meet some conditions on a daily chart and other conditions on weekly or monthly charts.
It worth to mention that the historical screening feature gets more flexible in the Formula Screener.
You can specify offset value for any criteria in a formula expression in days or in weeks or months if
the corresponding time periods were set for the criteria.
Range screening leverages the above approach and provides you with the ability to set a condition to be met within some period
of time. Let say you may allow moving average crossover to occur within last 3 days or require an oscillator
to be in oversold zone all time last 10 days.
Please note, that when combining many conditions in a formula, it is important to use parentheses so that the screener
knows what order to evaluate each condition.
The following examples demonstrate how to code maximally flexible criteria in formula expressions:

Formula Example

Explanation

Simple expressions

exch(nasdaq)
and cap > 1
and price >= 5
and avol > 1
and price casma(50)

Exchange: NASDAQ and Capitalization > 1 million and Price > 5 and Average Volume > 1 million and Price Crossed Above MA(50)

exch(nasdaq, nyse)
and price trend_up 7
and ( rsi(14) div_bull
or macd(12,26,9) div_bull )

Exchange: NASDAQ or NYSE and Price Trending Up Last 7 Days and ( RSI(14) Bullish Divergence or MACD(12,26,9) Bullish Divergence )

avol > 1
andgapup > 20
and rsi(14) ib 80

Average Monthly Volume > 1 million and GapUp Greater than 20% and RSI(14) is Below 60

Negate operator

exch(nasdaq, nyse)
and ! sector(etf,financial)
and ! industry(425,426,427)
and price ca bbub(20,2)

Exchange: NASDAQ or NYSE
and not ETF or Financial sector
and not industry with code 425, 426 or 427
and Price Crossed Above Upper Band of BBands(20,2)

price trend_up 200
and !
( rsi(14) div_bear )

Price Trending Up Last 200 Days and not "RSI(14) Bearish Divergence"

Using different time periods

( rsi(20) ia 50 )@monthly
and ( price ia ema(20) )@weekly
and ( price ca sma(7) )@daily

RSI(20) Is Above 50 on monthly periods and
Price Is Above EMA(20) on weekly periods and
Price Crossed Above SMA(7) on daily periods

( cdl_ham @daily or cdl_buki @daily )
and ( cdl_lowl @weekly
or cdl_bu3ws @weekly
or cdl_wb @monthly )

Hammer or Bullish Kicker on daily periods and
Long White Line or Three White Soldiers on weekly periods or White Body on monthly periods

exch(iex)
and ( price ca sma(50) )@hourly

Exchange: IEX and Price Crossed Above SMA(50) on hourly periods

Please note that hourly periods are supported only for IEX and Forex exchanges.

Historical screening

(ema(7) ca ema(50))@2 and cdl_ham@1

EMA(7) Crossed Above EMA(50) 2 days ago
and "Hammer" 1 day ago
(The @2 and @1 designators here specify shift relative to the current bar the given amount of periods ago)

(price ca sma(7))@2@weekly
and (chopen > 5)@1@daily

Price Crossed Above SMA(7) on weekly periods 2 weeks ago
and Change From Open > 5% yesterday
(The @2 and @1 designators here specify shift relative to the current bar the given amount of periods ago)

sma(50) > sma(50)@10

Current value for SMA(50) is greater than value for SMA(50) taken 10 days ago

Range screening

(rsi(14) ca 80)@[0..4]

RSI(14) Crossed Above 80 within last 5 days/bars, equivalent for:
(rsi(14) ca 80)@0
or (rsi(14) ca 80)@1
or (rsi(14) ca 80)@2
or (rsi(14) ca 80)@3
or (rsi(14) ca 80)@4

(rsi(14) ia 80)@{0..4}

RSI(14) Is Above 80 during last 5 days/bars, equivalent for:
(rsi(14) ia 80)@0
and (rsi(14) ia 80)@1
and (rsi(14) ia 80)@2
and (rsi(14) ia 80)@3
and (rsi(14) ia 80)@4

Using data arrays

high[1] > high[2]
and low[1] > low[2]
and v[1] > 2 * v[2]
and close[0] > high[1]
and open[0] > low[1]

Previous bar shows ascending high and low with doubling volume
and current price is grater than previous high
and open price is grater than previous low

Note: The following abbreviations can be used to indicate the current values of open, high, low and close prices:
open = o, high = h, low = l, close = c = last = price

At least four of the five conditions in the expression must be met

Index conditions

(ema(7) > ema(200))@sp500

EMA(7) is above EMA(200) on S&P 500 chart. The following index tokens can be used:
dow, sp500, nasdaq, nasd100, ru1000, ru2000, ru3000, rumid, rumicro, vix, ftse100, ftse250, ftseall,
dax, hsi, sti, asx50, asx200, tsx

(advdec trend_up 10)@nasdaq
and (mo > 0)@nasdaq
and (msi > 0)@nasdaq

Nasdaq Composite Advance/Decline is trending up last 10 days and both McClillan Oscillator and Summation Index are above zero

Fundamental criteria

exch(nasdaq,nyse)
and eps > 5
and pe < 10
and roi > 50

Exchange: NASDAQ or NYSE and EPS > 5 and P/E < 10 and ROI > 5

sector( financial,
technology, services )
and tip_ptpm
> 100 and tip_ebitda > 100

"Sector is one of the following ( Financial, Technology, Services )
and "Pre-tax Profit Margin to Indystry Avg, %" > 100%
and "Earnings to Indystry Avg, %" > 100%

Technical criteria

( fibo_ta23
or fibo_ta38
or fibo_ta50 )
and ln_art

( "Price Touched 0.23 Fibonacci Support Level"
or "Price Touched 0.38 Fibonacci Support Level"
or "Price Touched 0.50 Fibonacci Support Level" )
and "Price Is Above Rising Trend Line" )

cap > 100 and price < 50
and ( cdl_lowl or price risunvol )

Capitalization > 100 mln
and Price < 50
and ( "Long White Line" or "Rising on Unusual Volume" )

( price ca sma(200) or price ca sma(50) )
and rsi(14) div_bull

( "Price Crossed Above MA(200)"
or "Price Crossed Above MA(50)" )
and "RSI(14) Bullish Divergence"

Access to trading position in the backtesting tool

price < posprice - 1

Formula expression can be used as a criteria for closing a position in the Strategy Backtest tool.
This can be done by ticking the "Extract criteria from screen" option and selecting the appropriate formula screen.
In this formula, you can get the value of the price at which the position was opened using the "posprice" literal.

In this example, we want to close a position as soon as the current price has fallen below the purchase price minus one dollar.

price cb sma(7) and price > 1.2 * posprice

In this example, we close the position when the price crosses down SMA(7), but only if the profit is already more than 20%.

price < low[posbar]

You can get the index of the day/bar on which the position was opened using the "posbar" literal.
In this example, we want to close the position as soon as the current price has fallen below the low price formed on the day the position is opened.

rsi(14) < evalat(rsi(14), posbar)

You can get the index of the day/bar on which the position was opened using the "posbar" literal and the "evalat" function.
In this example, we want to close the position as soon as the current price has fallen below the low price formed on the day the position is opened.

Comments

price ca sma(200) /* comments here */

You may add your comments inside a formula expresssion

You may write a formula directly in the Formula text area or use
Formula Expression Helper pane to build certain conditions and insert them into the formula one by one:
Select criteria Category and Group first, then chose specific criterion or technical event you would like to add to the formula expression.
The selected condition will appear in the Expression text field. It allows edits so you may adjust parameters before adding the condition to the formula.
Hit Insert into formula button to add the condition to the formula expression. Add other conditions the same way if necessary and perform final edits
of the expression in the Formula text area. To view matched stocks click on Run Screen link:

The following table contains the full list of indicators that can be used in formula expression.
They can also be accessed with the usage of Formula Expression Helper.

Indicator List

ac(5,34,5)

Accelerator Oscillator

ad

Accumulation / Distribution

advdec

Advance/Decline Line

advdecvol

Advance/Decline Volume Line

adx(14)

Average Directional Movement Index

ao(5,34)

Awesome Oscillator

aroon(25)

Aroon Indicator

aroonosc(25)

Aroon Oscillator

atr(14)

Average True Range

bs(5)

Balance Step

bb(20,2)

Bollinger BandWidth, %

bbands(20,2)

Bollinger Bands

bbub(20,2)

Upper Band of Bollinger Bands

bblb(20,2)

Lower Band of Bollinger Bands

beta(5)

Beta

bop

Balance Of Power

chmo(9)

Chande Momentum Oscillator

cho(3,10)

Chaikin Oscillator

chop(14)

Choppiness Index

cci(18)

Commodity Channel Index

cmf(20)

Chaikin Money Flow

dema(50)

Double Exponential Moving Average

dim(14)

Negative Directional Indicator (-DI)

dip(14)

Positive Directional Indicator (+DI)

ema(50)

Exponential Moving Average

ema(50,7)

Forward shifted Exponential Moving Average. The extra "7" at the end is the shifting parameter.

emae(50,20)

Exponential Moving Average Envelope

emaeub(50,20)

Upper Bound of Exponential Moving Average Envelope

emaelb(50,20)

Lower Bound of Exponential Moving Average Envelope

emarsi(14,9)

Exponential Moving Average of RSI

emv(14)

Ease of Movement

force(14)

Elder Force Index

hma(50)

Hull Moving Average

ichimoku(9,26,52)

Ichimoku

tenkan(9,26,52)

Ichimoku, Tenkun Line

kijun(9,26,52)

Ichimoku, Kijun Line

spana(9,26,52)

Ichimoku, Span A Line

spanb(9,26,52)

Ichimoku, Span B Line

chikou(9,26,52)

Ichimoku, Chikou Line

kama(30)

Kaufman Adaptive Moving Average

keltub(20,2,10)

Keltner Upper Band

keltlb(20,2,10)

Keltner Lower Band

macd(12,26,9)

MACD

macds(12,26,9)

MACD Signal Line

macdh(12,26,9)

MACD Histogram

mama(0.5,0.05)

MESA Adaptive Moving Average

mfi(14)

Money Flow Index

mhigh

Monthly Previous High

mlow

Monthly Previous Low

mclose

Monthly Previous Close

mi(25)

Mass Index

minusvi(14)

Vortex Indicator -VI Line

mo

McClellan Oscillator

mvo

McClellan Volume Oscillator

mom(12)

Momentum

msi

McClellan Summation Index

mvsi

McClellan Volume Summation Index

natr(14)

Normalized Average True Range

obv

On Balance Volume

pp

Pivot Point

ps1

Pivot Point (S1)

ps2

Pivot Point (S2)

pr1

Pivot Point (R1)

pr2

Pivot Point (R2)

plusvi(14)

Vortex Indicator +VI Line

ppo(12,26,9)

Percentage Price Oscillator

ppoh(12,26,9)

PPO Histogram

psar(0.02,0.2)

Parabolic SAR

range(5)

Range

roc(10)

Price Rate of Change

rci(10)

Rank Correlation Index

rmi(14,10)

Relative Momentum Indicator

rs5

1-Week Relative Strength

rs10

2-Week Relative Strength

rs21

1-Month Relative Strength

rs68

3-Month Relative Strength

rs126

6-Month Relative Strength

rs252

1-Year Relative Strength

rsi(14)

Relative Strength Index

sma(50)

Simple Moving Average

sma(50,7)

Forward shifted Simple Moving Average. The extra "7" at the end is the shifting parameter.

Upper Line of Linear Regression Channel (period, number of standard deviations)

mlr(100,2)

Middle Line of Linear Regression Channel (period, number of standard deviations)

llr(100,2)

Lower Line of Linear Regression Channel (period, number of standard deviations)

vma(20)

Volume Moving Average

vo(7,14)

Volume Oscillator

vr(21)

Volume Ratio

vwma(50)

Volume Weighted Moving Average

wad

William's Accumulation / Distribution

wavetrend(10,21)

WaveTrend Oscillator

wts(10,21)

WaveTrend Signal Line

wild(21)

Wilder Moving Average

wma(50)

Weighted Moving Average

wma(50,7)

Forward shifted Weighted Moving Average. The extra "7" at the end is the shifting parameter.

wpr(14)

Williams` Percent Range

whigh

Weekly Previous High

wlow

Weekly Previous Low

wclose

Weekly Previous Close

yhigh

Yealy Previous High

ylow

Yealy Previous Low

yclose

Yealy Previous Close

zigzag(7)

ZigZag

Technical Events

Event

Explanation

Formula sample

ca

Crossed Above

ema(7) ca ema(50)

cb

Crossed Below

ema(7) cb ema(50)

ia

Is Above

price ia ema(50)

ib

Is Below

price ib ema(50)

tocha

Touched Above

price tocha sma(50)

tochb

Touched Below

price tochb sma(50)

bon_up

Bounced Up From

price bon_up bblb(20,2)

bon_dn

Bounced Down From

price bon_dn bbub(20,2)

div_bull

Bullish Divergence

rsi(14) div_bull

div_bear

Bearish Divergence

rsi(14) div_bear

trend_up

Trending Up

price trend_up 7

trend_dn

Trending Down

price trend_dn 7

Function Example

Explanation

Highest and lowest prices

highest(10)

Returns the highest price over a specific number of days/bars

lowest(10)

Returns the lowest price over a specific number of days/bars

highestbar(10)

Returns the shift of the highest price over a specific number of days/bars

lowestbar(10)

Returns the shift of the lowest price over a specific number of days/bars

highestvol(10)

Returns the highest volume value over a specific number of days/bars

lowestvol(10)

Returns the lowest volume value over a specific number of days/bars

highestvolbar(10)

Returns the shift of the highest volume value over a specific number of days/bars

lowestvolbar(10)

Returns the shift of the lowest volume value over a specific number of days/bars

highestclose(10)

Returns the highest close price over a specific number of days/bars

lowestclose(10)

Returns the lowest close price over a specific number of days/bars

highestoc(10)

Returns the highest open or close price over a specific number of days/bars

lowestoc(10)

Returns the lowest open or close price over a specific number of days/bars

highestclosebar(10)

Returns the shift of the highest close price over a specific number of days/bars

lowestclosebar(10)

Returns the shift of the lowest close price over a specific number of days/bars

highestocbar(10)

Returns the shift of the highest open or close price over a specific number of days/bars

lowestocbar(10)

Returns the shift of the lowest open or close price over a specific number of days/bars

Stock universe

ticker(fb,aapl,msft)

The ticker function allows you to run the screener only on the ticker names specified as parameters. May not include more than 100 ticker names. Use the Watch List tool to run the screener on a larger ticker list.

Calendar functions

day(1)

Returns true if current day of month equals to the parameter value. The parameter value must be in range of 1..31

weekday(Sun)

Returns true if current day of week equals to the parameter value. The parameter value must be in range of Sun..Sat

month(Jan)

Returns true if current month equals to the parameter value. The parameter value must be in range of Jan..Dec

Candlestick functions

wick(0)

Returns the size of the "upper shadow" part of a candle. The parameter value is the shift relative to the current bar

tail(0)

Returns the size of the "lower shadow" part of a candle. The parameter value is the shift relative to the current bar

body(0)

Returns the size of the "real body" part of a candle. The parameter value is the shift relative to the current bar

crange(0)

The range the price moved during the time frame of the candlestick (high - low). The parameter value is the shift relative to the current bar

bmid(0)

The middle of the candlestick's "real body" (close + open) / 2. The parameter value is the shift relative to the current bar

tprice(0)

Returns the Typical Price value for a given bar: (high + low + close) / 3. The parameter value is the shift relative to the current bar

mprice(0)

Returns the Median Price value for a given bar: (high + low) / 2. The parameter value is the shift relative to the current bar

wprice(0)

Returns the Weighted Price value for a given bar: (high + low + 2 * close) / 4. The parameter value is the shift relative to the current bar

Aggregate functions

abs(rsi(14) - 50)

Returns the absolute (positive) value of an expression

max(rsi(14), 10)

Returns the maximum value of an expression for the specified number of days / bars

min(rsi(14), 10)

Returns the minimum value of an expression for the specified number of days / bars

avg(rsi(14), 10)

Returns the average value of an expression for the specified number of days / bars

count(rsi(14) < 30, 10)

Returns the number of days / bars for which the expression is true for the specified number of days / bars

Backtesting aids

evalat(sma(21) - sma(7), 10)

Returns the value of the expression specified as the first parameter at the day/bar specified in the second parameter.
The expression in this example works the same way as historical screening "(sma(21) - sma(7))@10" but the second parameter can contain any arithmetic expression, for example:
evalat(sma(21) - sma(7), min(rsi(14), 7))

Time functions

last_update()

Returns the number of minutes since the last stock quote update