Back to builder reference
Value ref
rolling_maxHighest value of source over the prior lookback_bars — excludes the current bar.
source accepts ANY value ref, not just a price field: an indicator, a
spread, or a nested expression. That is what makes normalisations
composable — e.g. a stochastic of the MACD line is
(macd - rolling_min(macd)) / (rolling_max(macd) - rolling_min(macd))
built with binary_expr, with no dedicated indicator type.
Two behaviours to design around, both deliberate:
- The current bar is excluded (same convention as
donchian), so a close-exceeds-max breakout is meaningful — the current bar cannot contaminate its own threshold. For a stochastic you want an INCLUSIVE window, so rebuild one withbinary_expr:{"kind": "binary_expr", "op": "max", "left": <source>, "right": {"kind": "rolling_max", "source": <source>, "lookback_bars": N - 1}} - NaN propagates: one missing value anywhere in the window returns NaN
(no silent zero-substitution while
sourceis still warming up), and a NaN operand makes the enclosing compare false. Indicators with their own NaN-compacting buffers —srsi_k,stochastic_k— do NOT behave this way, which is why they are not redundant with this ref.
Backing types
RollingMaxValueRef
Required fields
None.
Optional fields
None.
Backing types
The IR ValueRef classes this builder field resolves to.
RollingMaxValueRef