{
  "additionalProperties": false,
  "description": "Trailing stop exit (ATR-multiple or percent trail distance).\n\nTracks the highest (or lowest) price since entry and exits when price\nretraces from that extreme by either ``atr_mult * ATR(atr_period)`` or\n``trail_pct`` percent of the extreme. Set at most one of atr_mult or\ntrail_pct; omitting both defaults to ``atr_mult=2.0`` over ``ATR(20)``.\n\nOptionally delays trailing stop activation until a minimum profit threshold\nis reached (activation_pct), implementing a \"trailing take profit\" pattern.\n\n2-3 params -> ~35 JSON nodes of state, hooks, and conditions.\n\n**Trail update model** (VIB-2048): the trail ratchets from the intrabar\nextreme (highest_high for long, lowest_low for short) and is enforced as a\nnative standing STOP order whose level is amended each bar. It therefore\nfills **intrabar at the trail level** \u2014 a wick piercing the trail stops out\non that bar, with no next-open gap. To trail from bar closes instead, use\nthe `trailing_state` smart card with `update_price=close`.\n\n**Exit precedence**: `trailing_stop` compiles to a broker-level standing\nSTOP that the fill simulator resolves alongside `fixed_targets` SL/TP,\nbefore per-bar condition exits are evaluated. Within the standing-order\ntier, OHLC fill priority governs same-bar contention.",
  "properties": {
    "activation_pct": {
      "anyOf": [
        {
          "maximum": 100.0,
          "minimum": 0.1,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Minimum profit % before trailing stop activates. None = activate immediately on entry.",
      "title": "Activation Pct"
    },
    "atr_multiplier": {
      "anyOf": [
        {
          "maximum": 10.0,
          "minimum": 0.5,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Atr Multiplier"
    },
    "atr_period": {
      "anyOf": [
        {
          "maximum": 200,
          "minimum": 5,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Atr Period"
    },
    "card_type": {
      "const": "trailing_stop",
      "default": "trailing_stop",
      "title": "Card Type",
      "type": "string"
    },
    "trail_pct": {
      "anyOf": [
        {
          "maximum": 50.0,
          "minimum": 0.1,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Trail distance as a percent of the extreme price since entry. Mutually exclusive with atr_mult.",
      "title": "Trail Pct"
    },
    "update_rule": {
      "default": "max",
      "enum": [
        "max",
        "min"
      ],
      "title": "Update Rule",
      "type": "string"
    }
  },
  "title": "TrailingStopCard",
  "type": "object"
}
