Back to builder reference

Value ref

percentile

Percentile RANK of the current bar's field (or of any source value) within the trailing lookback_bars window.

Returns 100 * (values strictly below the current one) / (lookback_bars - 1) over a window that includes the current bar: a new window high reads 100, a new window low reads 0. Ties are not counted, so a perfectly flat window reads 0.

This is the inverse of rolling_stats(stat="percentile"), which returns the value sitting at a given percentile level. Use this ref to ask "how extreme is price right now", and rolling_stats to ask "what price is the 90th percentile". NaN propagates: any missing value in the window returns NaN.

source ranks any value ref rather than a price field, so "is the volume unusually high" or "is the band width unusually narrow" is one operand: lookback_bars (2 to 500) is the window the current value is ranked in. Every bar in the window is evaluated, so a long window over a nested expression costs more than a price field does.

Example, the percentile of the Bollinger band width over 100 bars: {"kind": "percentile", "lookback_bars": 100, "source": {"kind": "binary_expr", "op": "-", "left": {"kind": "indicator", "indicator": "bollinger", "output": "upper"}, "right": {"kind": "indicator", "indicator": "bollinger", "output": "lower"}}}

Backing types

PercentileValueRef

Required fields

None.

Optional fields

None.

Backing types

The IR ValueRef classes this builder field resolves to.

PercentileValueRef
Quawd

A subscription SaaS platform for designing, backtesting, and paper-trading algorithmic trading strategies on equities and crypto — described in plain English to an AI agent, no code required.

© 2026 Quawd. All rights reserved.

Quawd is a software tool, not a broker-dealer or investment adviser, and does not provide investment advice. Trading involves substantial risk of loss. Backtested and hypothetical results have inherent limitations and are not indicative of future performance.