Skip to main content

Marker Legs

In MesoSim, a marker leg is an option leg with Qty set to 0. It selects a contract whose quotes, Implied Volatility, Greeks, strike, and expiration you can use in strategy expressions without adding market exposure.

Use markers to compare Implied Volatility across strikes, filter a selected strategy, or follow a contract for a later adjustment. Add them alongside your trading legs in the AI Job Editor.

Defining Marker Legs

Add a leg with "Qty": "0" to Structure.Legs. Choose its expiration and strike just as you would for a trading leg.

This fragment adds a call and a put near 10 Delta in magnitude. Merge the legs into your existing structure, retaining your trading legs and an expiration named front in Structure.Expirations.

{
"Structure": {
"Legs": [
{
"Name": "marker_call",
"Qty": "0",
"ExpirationName": "front",
"StrikeSelector": { "Delta": "10" },
"OptionType": "Call"
},
{
"Name": "marker_put",
"Qty": "0",
"ExpirationName": "front",
"StrikeSelector": { "Delta": "10" },
"OptionType": "Put"
}
]
}
}

A marker follows the selected contract as the simulation advances. It does not continuously reselect a new 10-Delta contract as the market moves. Use an explicit MoveLegAdjustment when you want to select a different contract.

Behavior

ValueMarker behavior
leg_marker_call_qtyRemains 0
leg_marker_call_bid, leg_marker_call_ask, leg_marker_call_priceQuotes and valuation price for the selected contract
leg_marker_call_ivImplied Volatility in percent; 20 means 20%
leg_marker_call_delta, gamma, theta, vega, wvega, rhoPer-contract Greeks, using the full variable name for each, such as leg_marker_call_theta
leg_marker_call_strike, leg_marker_call_dte, leg_marker_call_ditStrike, days to expiration, and days since the leg was created
Position Greeks such as pos_delta and pos_vegaMarker legs contribute zero

Replace marker_call with your own leg name. See the Script Engine leg reference for the complete variable list.

Marker values become available after the corresponding leg has been selected. Use Entry.AbortConditions for filters based on markers; Entry.Conditions runs before leg selection. The selected values can also be used in Entry.VarDefines and later adjustment or exit expressions.

Example Uses

Filter entry by the Implied Volatility difference

Using the two markers above, abort an entry when the absolute IV difference is at most two percentage points. This allows entry only when the difference exceeds two, subject to the strategy's other requirements.

{
"Entry": {
"AbortConditions": [
"abs(leg_marker_put_iv - leg_marker_call_iv) <= 2"
]
}
}

For example, 24% put IV and 21% call IV give a difference of three percentage points. This example measures the size of the difference in either direction. If you specifically want put IV to exceed call IV, use the signed difference without abs.

See Filtering by Implied Volatility for related entry, adjustment, and exit rules.

Capture the starting values

Store the IV difference and a marker's Greek at entry so you can compare them with later values or analyze their relationship with final PnL:

{
"Entry": {
"VarDefines": {
"initial_iv_gap": "leg_marker_put_iv - leg_marker_call_iv",
"initial_marker_vega": "leg_marker_put_vega"
}
}
}

Use the Events Viewer to inspect the captured values. Analytics with DataVoyager shows how to plot entry variables against final PnL, and Events export explains how to capture values for further analysis.

Track a contract for a later trade

An AddLegsAdjustment can use a marker's strike in its selector:

{
"StrikeSelector": {
"StrikePrice": "leg_marker_put_strike"
}
}

Choose the intended option type and expiration as well; the same strike alone does not identify the same contract. Review LegSelectionConstraint if the new leg must reuse the marker's contract. Adding a trading leg is a separate action; the marker keeps its zero quantity.

Forward evaluation with Options Valuation

Use a marker as an individual target in the Options Valuation Model to project that contract's PnL or Greeks as if its quantity were 1. The same behavior applies to options.model_solver when searching a range of underlying prices.

For the marker_call defined above, capture its projected Delta two days ahead with the underlying up 5%, and its maximum projected Vega within a price range:

{
"Entry": {
"VarDefines": {
"marker_delta_in_two_days": "options.model(leg_marker_call, 2, underlying_price * 1.05, delta)",
"marker_max_vega_in_two_days": "options.model_solver(leg_marker_call, 2, underlying_price * 0.9, underlying_price * 1.1, vega, maximize, return_value)"
}
}
}

Choose a horizon before the marker expires when studying its future Greeks. These calculations observe the marker contract; they do not create exposure. Calls targeting position continue to exclude the marker's contribution.

Usage Notes

  • Keep marker analysis separate from position exposure. An individual marker is evaluated as if its quantity were 1. Its stored quantity remains 0, and it contributes zero to position totals, including position-level Options Valuation results.
  • Use clear names. A prefix such as marker_ distinguishes observed contracts from trading legs.
  • Check the selected contracts. Inspect their strikes, expirations, and recorded values in the Events Viewer. For visual comparisons across strikes and expirations, use the Volatility Surface.

For help composing a marker-based strategy, use the AI Job Editor. For full strategies with analysis, visit the Deltaray blog.