{
  "$defs": {
    "SwingSpec": {
      "additionalProperties": false,
      "description": "Swing point detection parameters.\n\nA swing low = bar where low < low[i-strength:i] AND low < low[i+1:i+strength+1].\nSwing is only confirmed after 'strength' bars pass (introduces latency).",
      "properties": {
        "min_prominence_atr": {
          "default": 0.0,
          "description": "Minimum prominence in ATR units (0 = no filter)",
          "maximum": 5,
          "minimum": 0,
          "title": "Min Prominence Atr",
          "type": "number"
        },
        "selection": {
          "default": "most_recent",
          "description": "Which swing to return: most_recent or most_extreme in lookback",
          "enum": [
            "most_recent",
            "most_extreme"
          ],
          "title": "Selection",
          "type": "string"
        },
        "strength": {
          "description": "Bars on each side to confirm swing",
          "maximum": 20,
          "minimum": 2,
          "title": "Strength",
          "type": "integer"
        }
      },
      "required": [
        "strength"
      ],
      "title": "SwingSpec",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "description": "Detect price crossing a level up or down.\n\nFires when price crosses through the specified level in the given direction.\nProvide exactly one of level_price, level_reference, or swing.\nWhen swing is provided, the level is the most recent confirmed swing high or low.",
  "properties": {
    "level_direction": {
      "enum": [
        "up",
        "down"
      ],
      "title": "Level Direction",
      "type": "string"
    },
    "level_price": {
      "anyOf": [
        {
          "exclusiveMinimum": 0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Level Price"
    },
    "level_reference": {
      "anyOf": [
        {
          "enum": [
            "previous_low",
            "previous_high",
            "recent_support",
            "recent_resistance",
            "session_low",
            "session_high"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Level Reference"
    },
    "swing": {
      "anyOf": [
        {
          "$ref": "#/$defs/SwingSpec"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Use swing-point detection instead of rolling min/max"
    },
    "type": {
      "const": "price_level_cross",
      "default": "price_level_cross",
      "title": "Type",
      "type": "string"
    }
  },
  "required": [
    "level_direction"
  ],
  "title": "PriceLevelCrossCondition",
  "type": "object"
}
