Stock Screener - US Stocks, Forex and ETFs Please enable JavaScript to view this page content properly Log In | Sign Up
Formula Screener

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 ca sma(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
low[0] > 1.05 * high[1] and close[0] > 1.05 * open[0]

Gap up is grater than 5%,
and change from open is grater than 5%
v[0] > 1 and open[0] > close[1] + 10

Today's volume is greater than 1 million and open price is grater than previous close + $10

Aggregate functions

price > max( h, 10 )@1
The current price is higher than the maximum value of high prices calculated for the last 10 days at the time of yesterday
price < min( l, 10 )@1
The current price is lower than the minimum value of low prices calculated for the last 10 days at the time of yesterday
max( ema(200), 10 ) - min( ema(200), 10 ) < .02 * price
The difference between the maximum and minimum value of the EMA indicator for the last 10 days is less than 2% of the price
avg( rsi(14), 10 ) > 80
The average value of the RSI indicator for the last 10 days is above 80
abs( rsi(14) - 50 ) > 40
The absolute value of the difference between the value of the RSI indicator and 50 is greater than 40

Scoring conditions

(price trend_up 21) + (price risunvol) + (price higher_highs 7) >= 2

At least two of the three conditions in the expression must be met

Note: each condition in the expression is converted to 0 or 1, depending on whether it is met or not
(rsi(14) div_bull) + (ao(5,34) div_bull) + (cci(14) div_bull) + (mom(14) div_bull) + (stoch(5,3,3) div_bull) >= 4

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:

formula screner helper



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
adAccumulation / Distribution
advdecAdvance/Decline Line
advdecvolAdvance/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
bopBalance 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
mhighMonthly Previous High
mlowMonthly Previous Low
mcloseMonthly Previous Close
mi(25)Mass Index
minusvi(14)Vortex Indicator -VI Line
moMcClellan Oscillator
mvoMcClellan Volume Oscillator
mom(12)Momentum
msiMcClellan Summation Index
mvsiMcClellan Volume Summation Index
natr(14)Normalized Average True Range
obvOn Balance Volume
ppPivot Point
ps1Pivot Point (S1)
ps2Pivot Point (S2)
pr1Pivot Point (R1)
pr2Pivot 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
rs51-Week Relative Strength
rs102-Week Relative Strength
rs211-Month Relative Strength
rs683-Month Relative Strength
rs1266-Month Relative Strength
rs2521-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.
smae(50,20)Simple Moving Average Envelope
smarsi(14,9)Simple Moving Average of RSI
smi(5,3,3)Stochastic Momentum Indicator
snr_res(9,1)The first resistance level of S&R indicator
snr_sup(9,1)The first support level of S&R indicator
snroc_res(9,1)The first resistance level of S&ROC indicator
snroc_sup(9,1)The first support level of S&ROC indicator
snrc_res(9,1)The first resistance level of S&RC indicator
snrc_sup(9,1)The first support level of S&RC indicator
stc(23,50,10)Schaff Trend Cycle
stddev(5,1)Standard Deviation
stoch(5,3,3)Stochastic Oscillator (fast %K, slow %K, slow %D)
slowk(5,3,3)Stochastic Oscillator (fast %K, slow %K, slow %D), slow %K Line
slowd(5,3,3)Stochastic Oscillator (fast %K, slow %K, slow %D), slow %D Line
stochrsi(14)Stochastic RSI
supertrend(3,7)SuperTrend Indicator
tema(50)Triple Exponential Moving Average
tmf(21)Twiggs Money Flow
tsi(25,13)True Strength Index
uo(7,14,28)Ultimate Oscillator
udon(20)Upper Donchian
mdon(20)Middle Donchian
ldon(20)Lower Donchian
ulr(100,2)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
wadWilliam'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
whighWeekly Previous High
wlowWeekly Previous Low
wcloseWeekly Previous Close
yhighYealy Previous High
ylowYealy Previous Low
ycloseYealy Previous Close
zigzag(7)ZigZag



 Technical Events
EventExplanationFormula sample
caCrossed Aboveema(7) ca ema(50)
cbCrossed Belowema(7) cb ema(50)
iaIs Aboveprice ia ema(50)
ibIs Belowprice ib ema(50)
tochaTouched Aboveprice tocha sma(50)
tochbTouched Belowprice tochb sma(50)
bon_upBounced Up Fromprice bon_up bblb(20,2)
bon_dnBounced Down Fromprice bon_dn bbub(20,2)
div_bullBullish Divergencersi(14) div_bull
div_bearBearish Divergencersi(14) div_bear
trend_upTrending Upprice trend_up 7
trend_dnTrending Downprice 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
 

 Content
 Overview
 Data
 Stock Screener
      Quick Start
      Screener Parameters
      How to Screen Watch List
      Formula Screener
      Technical Criteria
 Strategy Backtest
      New Strategy
      How It Works
      Testing Model
      Position Maintenance
      How to Backtest Watch List
 Charts
 Portfolio Tracker
 Trade Alert
 Price Alert
 Stock Correlation



Disclaimer - Privacy Policy - Cookie Use Policy - FAQ - Contact Us
Copyright ©2008-2019 MarketInOut.com. All rights reserved.
Best viewed in