{
  "$defs": {
    "BandSpec": {
      "additionalProperties": false,
      "description": "Band specification for technical indicators.\n\nIMPORTANT: 'length' is in BARS, not days. Effective lookback horizon =\ntf \u00d7 length (e.g., 720 bars \u00d7 1h \u2248 30 days, 24 bars \u00d7 1h \u2248 1 day).\nMaximum length is 400 bars.",
      "properties": {
        "anchor": {
          "anyOf": [
            {
              "enum": [
                "session",
                "week",
                "month"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Anchor point for AVWAP-based bands (session/week/month supported)",
          "title": "Anchor"
        },
        "band": {
          "enum": [
            "bollinger",
            "keltner",
            "donchian",
            "vwap_band"
          ],
          "title": "Band",
          "type": "string"
        },
        "length": {
          "description": "Number of BARS for lookback. Must be >=1 for bollinger/keltner/donchian; vwap_band is anchor-driven and accepts 0.",
          "maximum": 400,
          "minimum": 0,
          "title": "Length",
          "type": "integer"
        },
        "mult": {
          "default": 2.0,
          "description": "Standard deviation multiplier",
          "maximum": 5.0,
          "minimum": 0.1,
          "title": "Mult",
          "type": "number"
        }
      },
      "required": [
        "band",
        "length"
      ],
      "title": "BandSpec",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "description": "Detect price touching or crossing a band edge (upper, lower, or mid).\n\nFires when price interacts with the specified edge of a Bollinger, Keltner,\nor Donchian band. Events: touch (reaches edge), cross_in (enters from outside),\ncross_out (exits to outside).",
  "properties": {
    "band": {
      "$ref": "#/$defs/BandSpec"
    },
    "edge": {
      "enum": [
        "upper",
        "lower",
        "mid"
      ],
      "title": "Edge",
      "type": "string"
    },
    "event": {
      "enum": [
        "touch",
        "cross_in",
        "cross_out"
      ],
      "title": "Event",
      "type": "string"
    },
    "type": {
      "const": "band_edge",
      "default": "band_edge",
      "title": "Type",
      "type": "string"
    }
  },
  "required": [
    "band",
    "edge",
    "event"
  ],
  "title": "BandEdgeCondition",
  "type": "object"
}
