Back to builder reference

Value ref

trade_history

A statistic computed from the strategy's own closed-trade history.

field selects the metric: trade_count (closed trades so far), consecutive_wins / consecutive_losses (current streak length), last_pnl / last_pnl_pct (the most recently closed trade's PnL), rolling_win_rate / rolling_avg_pnl_pct (win rate / average PnL% over the last lookback_bars closed trades — lookback_bars is REQUIRED for these two and forbidden for every other field, since it counts TRADES, not bars), or bars_since_last_exit.

Before the first trade closes: trade_count, consecutive_wins and consecutive_losses are all-time counters and read 0. The other five have no value yet -- a typed absence (no_position), not a number -- so a condition reading one is UNKNOWN and takes no action (neither true nor false), and a formula sizing over one blocks readiness because it could never size the first entry.

The sub-metric selector is named field.

Backing types

TradeHistoryValueRef

Required fields

fieldreqenum: trade_count, consecutive_wins, consecutive_losses, last_pnl, last_pnl_pct, rolling_win_rate, rolling_avg_pnl_pct, bars_since_last_exit-

Optional fields

kindstring-
lookback_barsanyOf (2 variants)-
resolutionnullUnsupported on this value ref; only null is accepted.
symbolnullUnsupported on this value ref; only null is accepted.

Backing types

The IR ValueRef classes this builder field resolves to.

TradeHistoryValueRef
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.