builder_add_conditionAdd a single condition card to a strategy and get back its card_id and name.
Area
Strategy Builder
Group
Authoring
Access
Write
Risk
May change server state
Details
Full description
Details
Add a condition card to the strategy. Returns a card_id and canonical name. If the condition type is known, use builder_discover(action='get', ref="<type>") for its direct schema. If it is unfamiliar or the task spans conditions, value refs, configuration, workflows, or recipes, start with builder_discover(action="facets"), narrow with exact list filters, then get a returned ref.
Multi-timeframe — set resolution inside an lhs/rhs value ref:
{"type": "compare",
"lhs": {"type": "indicator", "indicator": "ema", "period": 14, "resolution": "4h"},
"op": ">", "rhs": 50}
Cross-instrument market gate — e.g. only long when SPY is in an uptrend:
{"type": "regime_filter", "direction": "uptrend",
"indicator": "price_vs_ma", "slow_period": 200, "symbol": "SPY"}
Cross-sectional (multi-sleeve / basket strategies only — single-symbol strategies reject these at compile time). Each compares this sleeve's value against portfolio siblings on the current bar.
Top-decile momentum (rank in the upper 10% of the universe):
{"type": "rank",
"source": {"type": "indicator", "indicator": "roc", "period": 20},
"op": ">", "value": 0.9}
Pairs-trade leg (long this sleeve when its close < QQQ's close):
{"type": "sibling_compare",
"source": {"type": "price", "field": "close"},
"op": "<", "symbol": "QQQ",
"sibling_source": {"type": "price", "field": "close"}}
Operates on
Builder objects this tool reads or produces, linked to their reference pages.
Capabilities
Bounded options and operating modes surfaced above the full JSON schema.
Required Inputs
conditionobjectCondition dict with "card_type" or "type". If the type is known, use builder_discover(action='get', ref=<ref>) for its direct schema. Otherwise start with builder_discover(action='facets'), then list exact filters and get a returned ref. For saved named zones, create the zone with builder_save_zone, then use compare/cross with value_ref:named_zone on lhs/rhs. Inspect 'pattern:named_zone_compare', 'pattern:named_zone_cross', and 'value_ref:named_zone' for examples.strategy_idstringStrategy ID from builder_createOptional Inputs
nameanyOf (2 variants)optional strategy-scoped agent-facing identifier (snake_case, ≤48 chars, leading letter, unique within strategy, cannot be 'entry'/'exit'/'gate'/'overlay' or match the auto-ID shape 'c_<8 hex chars>'). If omitted, a deterministic name is auto-generated from the condition spec (e.g. 'close_gt_ema20'). Use this name when addressing the card in sweep override labels: {"label": "entry.<name>", ...}. Rename later via builder_rename_condition.scan_run_idanyOf (2 variants)Optional ID of the signal scan run that validated this condition. Pass this when adding a condition that was validated by signal_scan to link the evidence back to the card.