EquationDB

← Back to all articles

Writing your first screen in EquationDB

30 September 2026 · EquationDB team

Most screeners give you a form: pick a field, an operator and a number, add another row. EquationDB gives you one line of text instead, and that line can grow with your idea. Here is how a typical screen comes together.

Start with the question

Say you want stocks in a long-term uptrend that have pulled back. Start with the uptrend:

GET top500 WHERE close > sma(200)

top500 is the universe: the 500 largest US companies. close > sma(200) keeps the ones closing above their 200-day moving average. Every indicator is kept up to date as data arrives, so this answers in milliseconds.

Add the pullback

GET top500 WHERE close > sma(200) AND close < sma(20) SORT rsi(14)

Now the price must also be below its 20-day average: a short-term dip inside a long-term trend. SORT rsi(14) puts the most oversold first.

Choose what you see

GET top500 SELECT symbol, sector, close, rsi(14), dist_high(252) WHERE close > sma(200) AND close < sma(20) SORT rsi(14) LIMIT 20

SELECT picks the columns; dist_high(252) shows how far each stock sits below its one-year high. LIMIT 20 keeps the list short enough to read.

Judge each stock against the right yardstick

An RSI of 35 means something different for a utility than for a chip maker. Two ways to make the threshold fair:

GET top500 WHERE rsi(14) < pctl(10) OVER sector AND close > sma(200)

pctl(10) OVER sector compares each stock with its own sector today, so you get the weakest names in every sector, not a list dominated by one.

GET top500 WHERE rsi(14) < pctl(5) AND close > sma(200)

pctl(5) without OVER compares each stock with its own history: RSI below its personal 5th percentile.

Ask whether it has worked

A screen tells you what is true now. Before acting on it, check what usually happened next:

OUTCOMES AFTER rsi(14) CROSS BELOW 30 AND close > sma(200) IN top500 SINCE 2010-01-01 FWD 5d, 20d

This measures the forward returns after every occurrence since 2010 and compares them with the same stocks' ordinary returns (edge_pct), with a t-statistic. If the edge is small, the screen is a list of names, not a signal.

Keep it

Press Save in the Query editor to keep the screen, or turn it into an alert that tells you when a new name qualifies:

WHEN rsi(14) CROSS BELOW 30 AND close > sma(200) IN top500 THEN notify

Where to go next