Skip to main content

ScriptEngine Variables

This page maps the MesoSim Script Engine variables to their support level in MesoLive.

Source reference (MesoSim): Script Engine variables

For ScriptEngine helper functions (time/calendar and options valuation), see ScriptEngine Modules.

note

In MesoLive, expressions can fail to evaluate if market data is missing/stale or if required variables were not set (for example, due to a failed build). When that happens the UI surfaces an Eval failed message in the relevant place (Build/Signals/Adjustments).

Expiration variables

VariableStateNote
expiration_EXPNAME_dteSupportedUpdated based on the selected expiration(s).
expiration_EXPNAME_minSupportedAvailable during expiration selection (Build/Adjustments).
expiration_EXPNAME_maxSupportedAvailable during expiration selection (Build/Adjustments).

Leg variables

VariableStateNote
leg_LEGNAME_priceSupportedMark/Model/Mid semantics follow the Portal’s pricing mode and provider.
leg_LEGNAME_bidSupportedRequires live quotes for the leg contract.
leg_LEGNAME_askSupportedRequires live quotes for the leg contract.
leg_LEGNAME_qtySupportedQuantity tracked in MesoLive for the leg.
leg_LEGNAME_ivSupportedPercent (0–100), aligned with MesoSim.
leg_LEGNAME_deltaSupportedQty-scaled; marker legs expose per-1-unit values.
leg_LEGNAME_gammaSupportedQty-scaled; marker legs expose per-1-unit values.
leg_LEGNAME_thetaSupportedQty-scaled; marker legs expose per-1-unit values.
leg_LEGNAME_vegaSupportedQty-scaled; marker legs expose per-1-unit values.
leg_LEGNAME_wvegaSupportedDTE-weighted vega.
leg_LEGNAME_rhoNot supportedPresent but always 0 (rho is not currently supplied by live data providers in MesoLive).
leg_LEGNAME_ditSupportedDecimal days since leg creation time.
leg_LEGNAME_dteSupportedDecimal days to expiration settlement.
leg_LEGNAME_strikeSupportedStrike of the selected contract.
leg_LEGNAME_pnlSupportedAvailable once MesoLive can compute leg PnL for the position.

Position variables

VariableStateNote
profit_targetSupportedPersisted at entry from the Strategy Definition.
stop_lossSupportedPersisted at entry from the Strategy Definition.
max_days_in_tradeSupportedPersisted at entry from the Strategy Definition.
pos_pnlSupportedPosition PnL (running + realized).
pos_realized_pnlSupportedRealized PnL tracked from executions and user adjustments.
pos_deltaSupportedSum of leg deltas.
pos_gammaSupportedSum of leg gammas.
pos_thetaSupportedSum of leg thetas.
pos_vegaSupportedSum of leg vegas.
pos_wvegaSupportedWeighted vega (DTE-weighted).
pos_rhoNot supportedPresent but always 0 (rho not currently supplied).
pos_marginNot supportedNot currently computed in MesoLive.
open_legs_cntSupportedNumber of open legs in the position.

Account variables

VariableStateNote
navSupportedUses the most recent account summary received via the Agent.
initial_cashNot supportedSimulation-only (MesoSim backtests).
pos_in_flightNot supportedConcurrency gating is implemented server-side and does not expose this variable to expressions.

Underlying variables

VariableStateNote
underlying_priceSupportedProvider-specific live price.
underlying_today_openSupported (may be missing)Availability depends on instrument/provider; some combinations may not supply it reliably.
underlying_prevday_closeSupported (may be missing)Availability depends on instrument/provider.
underlying_ivSupported (provider-dependent)Percent (0–100). For TastyTrade mode, MesoLive may backfill IV from IBKR if available.
underlying_iv_rankSupported (different)Uses a daily IV history up to the last close (not intraday like MesoSim).
underlying_iv_pctSupported (different)Uses a daily IV history up to the last close (not intraday like MesoSim).
underlying_hvSupported (provider-dependent)Percent (0–100). For TastyTrade mode, MesoLive may backfill HV from IBKR if available.

Timing variables

VariableStateNote
minutes_after_openSupported (deprecated)Rounded down to 5-minute resolution (matches MesoSim).
minutes_before_closeSupported (deprecated)Rounded down to 5-minute resolution (matches MesoSim).

User-defined and external data variables

VariableStateNote
User-defined variablesSupportedDefined via VarDefines (Entry and conditional adjustments). See VarDefines.
External data variablesSupportedPopulated from ExternalData during Build and updates.