{
  "additionalProperties": false,
  "description": "Track a trailing price level and trigger when price crosses it.\n\nMaintains a ratcheting state (e.g., highest high since entry) offset by ATR.\nUse for trailing stop exits or trailing pullback entries.",
  "properties": {
    "atr_mult": {
      "default": 2.0,
      "description": "ATR multiplier for offset",
      "maximum": 10.0,
      "minimum": 0.1,
      "title": "Atr Mult",
      "type": "number"
    },
    "atr_period": {
      "default": 20,
      "description": "ATR period for offset calculation",
      "maximum": 500,
      "minimum": 5,
      "title": "Atr Period",
      "type": "integer"
    },
    "state_id": {
      "default": "trailing_level",
      "description": "ID for the trailing state variable",
      "title": "State Id",
      "type": "string"
    },
    "trigger_op": {
      "default": "below",
      "description": "Trigger when price goes above or below trailing level",
      "enum": [
        "above",
        "below"
      ],
      "title": "Trigger Op",
      "type": "string"
    },
    "trigger_price": {
      "default": "close",
      "description": "Price field to compare against trailing level",
      "enum": [
        "open",
        "high",
        "low",
        "close"
      ],
      "title": "Trigger Price",
      "type": "string"
    },
    "type": {
      "const": "trailing_state",
      "default": "trailing_state",
      "title": "Type",
      "type": "string"
    },
    "update_price": {
      "default": "high",
      "description": "Price field to track for state updates",
      "enum": [
        "open",
        "high",
        "low",
        "close"
      ],
      "title": "Update Price",
      "type": "string"
    },
    "update_rule": {
      "default": "max",
      "description": "How to update state: max (trails up) or min (trails down)",
      "enum": [
        "max",
        "min"
      ],
      "title": "Update Rule",
      "type": "string"
    }
  },
  "title": "TrailingStateCondition",
  "type": "object"
}
