Value ref
percentilePercentile 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
Optional fields
Backing types
The IR ValueRef classes this builder field resolves to.