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
| Variable | State | Note |
|---|---|---|
expiration_EXPNAME_dte | Supported | Updated based on the selected expiration(s). |
expiration_EXPNAME_min | Supported | Available during expiration selection (Build/Adjustments). |
expiration_EXPNAME_max | Supported | Available during expiration selection (Build/Adjustments). |
Leg variables
| Variable | State | Note |
|---|---|---|
leg_LEGNAME_price | Supported | Mark/Model/Mid semantics follow the Portal’s pricing mode and provider. |
leg_LEGNAME_bid | Supported | Requires live quotes for the leg contract. |
leg_LEGNAME_ask | Supported | Requires live quotes for the leg contract. |
leg_LEGNAME_qty | Supported | Quantity tracked in MesoLive for the leg. |
leg_LEGNAME_iv | Supported | Percent (0–100), aligned with MesoSim. |
leg_LEGNAME_delta | Supported | Qty-scaled; marker legs expose per-1-unit values. |
leg_LEGNAME_gamma | Supported | Qty-scaled; marker legs expose per-1-unit values. |
leg_LEGNAME_theta | Supported | Qty-scaled; marker legs expose per-1-unit values. |
leg_LEGNAME_vega | Supported | Qty-scaled; marker legs expose per-1-unit values. |
leg_LEGNAME_wvega | Supported | DTE-weighted vega. |
leg_LEGNAME_rho | Not supported | Present but always 0 (rho is not currently supplied by live data providers in MesoLive). |
leg_LEGNAME_dit | Supported | Decimal days since leg creation time. |
leg_LEGNAME_dte | Supported | Decimal days to expiration settlement. |
leg_LEGNAME_strike | Supported | Strike of the selected contract. |
leg_LEGNAME_pnl | Supported | Available once MesoLive can compute leg PnL for the position. |
Position variables
| Variable | State | Note |
|---|---|---|
profit_target | Supported | Persisted at entry from the Strategy Definition. |
stop_loss | Supported | Persisted at entry from the Strategy Definition. |
max_days_in_trade | Supported | Persisted at entry from the Strategy Definition. |
pos_pnl | Supported | Position PnL (running + realized). |
pos_realized_pnl | Supported | Realized PnL tracked from executions and user adjustments. |
pos_delta | Supported | Sum of leg deltas. |
pos_gamma | Supported | Sum of leg gammas. |
pos_theta | Supported | Sum of leg thetas. |
pos_vega | Supported | Sum of leg vegas. |
pos_wvega | Supported | Weighted vega (DTE-weighted). |
pos_rho | Not supported | Present but always 0 (rho not currently supplied). |
pos_margin | Not supported | Not currently computed in MesoLive. |
open_legs_cnt | Supported | Number of open legs in the position. |
Account variables
| Variable | State | Note |
|---|---|---|
nav | Supported | Uses the most recent account summary received via the Agent. |
initial_cash | Not supported | Simulation-only (MesoSim backtests). |
pos_in_flight | Not supported | Concurrency gating is implemented server-side and does not expose this variable to expressions. |
Underlying variables
| Variable | State | Note |
|---|---|---|
underlying_price | Supported | Provider-specific live price. |
underlying_today_open | Supported (may be missing) | Availability depends on instrument/provider; some combinations may not supply it reliably. |
underlying_prevday_close | Supported (may be missing) | Availability depends on instrument/provider. |
underlying_iv | Supported (provider-dependent) | Percent (0–100). For TastyTrade mode, MesoLive may backfill IV from IBKR if available. |
underlying_iv_rank | Supported (different) | Uses a daily IV history up to the last close (not intraday like MesoSim). |
underlying_iv_pct | Supported (different) | Uses a daily IV history up to the last close (not intraday like MesoSim). |
underlying_hv | Supported (provider-dependent) | Percent (0–100). For TastyTrade mode, MesoLive may backfill HV from IBKR if available. |
Timing variables
| Variable | State | Note |
|---|---|---|
minutes_after_open | Supported (deprecated) | Rounded down to 5-minute resolution (matches MesoSim). |
minutes_before_close | Supported (deprecated) | Rounded down to 5-minute resolution (matches MesoSim). |
User-defined and external data variables
| Variable | State | Note |
|---|---|---|
| User-defined variables | Supported | Defined via VarDefines (Entry and conditional adjustments). See VarDefines. |
| External data variables | Supported | Populated from ExternalData during Build and updates. |