universe_percentile

Universe Percentile (cross-stock ranking)

universe_percentile(field)

Parameters

Name Type Description
field field The data series or indicator to rank across stocks

Formula

```
universe_percentile(X) = (number of stocks with value < X) / (N - 1)
```
Result ranges from 0.0 to 1.0:
- 0.0 = lowest value in universe
- 1.0 = highest value in universe
- 0.5 = median value

Examples

// top 10% by turnover
universe_percentile(turnover) > 0.90;

// top 5% by volume
universe_percentile(volume) >= 0.95;

// top 25% by bar change %
universe_percentile(bar_change_pct) > 0.75;

// top 20% by 20-day SMA
x = sma(close, 20); universe_percentile(x) > 0.80;

Returns

Float between 0.0 and 1.0 (percentile rank across universe) ## Notes - Computed across ALL stocks in the scanned universe, not per-stock history - Raw-field percentiles are optimized to reduce the universe early, before expensive indicator calculations - Indicator-based percentiles (e.g., `universe_percentile(rsi(close, 14))`) require the indicator to be computed first, so they cannot be placed early - Ties share the same rank