Back to builder reference

Value ref

live_position

A metric of the CURRENTLY OPEN position, read live every bar (not a frozen snapshot from entry — contrast entry_bar/sequence_step, which capture a value once and hold it).

field selects: entry_price, bars_in_position, unrealized_pnl_pct / unrealized_pnl_usd, or max_excursion_pct / min_excursion_pct. All are NaN while flat.

entry_price is the quantity-weighted entry of the units still held, and unrealized_pnl_pct is the side-correct return on it. The excursions are the best and worst GROSS price return the position has reached while held (side-correct, before fees; never below 0 and never above 0). Each bar's high and low are valued against the weighted entry of the units held after that bar's fills, so the whole bar uses the entry the position has then, whatever point of the bar a fill came at (an intra-bar approximation). The extremes survive an add and a sale of the first lot, and reset when the position closes or flips side. They are not an episode row's mfe_pct / mae_pct, which are running profit over the peak cost (net of entry fees).

bars_in_position counts the bars the position has been open in, INCLUDING the bar it filled in: it is 1 at the close of the fill bar, not 0. An exit on bars_in_position >= N therefore decides at the close of the Nth held bar and fills at the next bar's open, so the trade's exit_bar - entry_bar is exactly N.

The sub-metric selector is named field.

Backing types

LivePositionValueRef

Required fields

fieldreqenum: entry_price, bars_in_position, unrealized_pnl_pct, unrealized_pnl_usd, max_excursion_pct, min_excursion_pct-

Optional fields

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

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