universe_percentile

Universe Percentile (cross-stock ranking)

universe_percentile(field)

Parameters

Name Type Description
field field Data series or indicator value to rank across the scanned universe

Formula

universe_percentile(X) = (number of stocks with value < X) / (N - 1)

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

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, while indicator-based percentiles like universe_percentile(rsi(close, 14)) require the indicator computed first and cannot be placed early; ties share the same rank

See Also

percentrank