New Functions: Instrument Filtering and Cross-Stock Ranking

February 14, 2026 Luis Gomez
New Functions: Instrument Filtering and Cross-Stock Ranking

Two new additions to StonQL tackle problems that previously required workarounds or post-scan filtering: separating ETFs from stocks, and finding where a stock ranks relative to everything else.

is_etf and is_stock: Know What You're Scanning

If you've ever run a momentum scan and found half your results were leveraged ETFs, you know the problem. ETFs behave differently from stocks — they don't gap the same way, they don't respond to earnings, and a "breakout" on SQQQ means something very different than one on NVDA.

Now you can filter them out (or exclusively target them) at the scan level:

is_stock; // will also work: is_stock == true;
rsi(close, 14) < 30;
volume > 1000000;

This gives you oversold stocks only — no ETFs cluttering the results. Flip it around if you want to scan ETFs specifically:

is_etf; // will also work: is_etf == true;
close > ema(close, 21);
volume > 500000;

The key benefit is that filtering happens before everything else. You're not wasting computation on instruments you'll ignore anyway, and your scan results are cleaner from the start.

These fields work with any other StonQL expression. Combine them with moving averages, MACD crossovers, volume analysis — whatever your scan needs.

universe_percentile(): Where Does This Stock Rank?

Most technical indicators tell you something about a stock in isolation. RSI says a stock is overbought relative to its own recent history. A moving average crossover says price is trending relative to its own past.

But sometimes you want to know: how does this stock compare to everything else right now?

That's what universe_percentile() does. It takes any numeric field or indicator and returns where that value falls as a percentile (0-100) across all stocks in your scan universe.

Find the top 10% of stocks by today's volume:

universe_percentile(volume) > 90;

Or combine it with other conditions — stocks with relatively high RSI that also rank in the top quartile by dollar volume:

rsi(close, 14) > 60;
universe_percentile(turnover) > 75;

This is particularly useful for building scans that adapt to market conditions. A fixed volume threshold like volume > 2000000 might catch 500 stocks on a volatile day and 50 on a quiet one. A percentile-based filter like universe_percentile(volume) > 80 always gives you the top 20%, regardless of overall market activity.

This also provides a deterministic way of filtering your stock universe regardless of timeframe. A filter of universe_percentile(volume) > 80 will always return the top 20% of stocks by volume, whether you're scanning the 1D, 1W, or 1M timeframes. Compare that with a simple volume filter like volume > 1M; -- this will vary wildly and won't have the same selectivity depending on which timeframe you're scanning.

You can rank by any numeric value — price fields, indicators, even computed expressions:

x = ema(close, 8) / ema(close, 21);
universe_percentile(x) > 95;

That scan finds stocks where the short-term trend is strongest relative to the entire market — the top 5% by EMA ratio.

Combining Both

Just like all other indicators in StonQL, the two features work well together. Filter your universe first, then rank within it:

is_stock; // is_stock == true will also work
universe_percentile(volume) > 80;
rsi(close, 14) < 40;

This finds stocks (not ETFs) that are pulling back on relatively high volume — the kind of setup that often precedes a reversal. The percentile filter ensures you're only looking at names with real participation, and the is_stock filter keeps the results focused on individual equities.

Both functions are available now in the scanner. Try them out at stocksfast.io/scanner.

Related Posts

Introducing StocksFast: A Stock Scanner for Technical Traders
Introducing StocksFast: A Stock Scanner for Technical Traders

A high-level introduction to StocksFast - motivation, what it is, what it does, and who it's for.

New Features: IPO Date Tracking & Synthetic Price Fields
New Features: IPO Date Tracking & Synthetic Price Fields

Find recent IPOs, filter stocks by listing age, and use new synthetic price fields like typical price (HLC3), OHLC4, and …

Undo/Redo Now Available in the Expression Editor
Undo/Redo Now Available in the Expression Editor

Edit your scan expressions with confidence. Made a mistake? Just undo it. Our expression editor now features undo and redo …