Back to builder reference

Value ref

rolling_max

Highest 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 with binary_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 source is 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
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.