{
  "additionalProperties": false,
  "description": "Regime gate: allow entries only when market is in uptrend or downtrend.\n\nSimplifies the most common gate pattern. Instead of manually composing compare +\nindicator conditions (which agents frequently get wrong), use this archetype:\n\n    {\"type\": \"regime_filter\", \"direction\": \"uptrend\", \"fast_period\": 20, \"slow_period\": 50}\n\nTwo indicator modes:\n- \"ema_cross\" (default): EMA(fast) - EMA(slow) > 0 for uptrend, < 0 for downtrend\n- \"price_vs_ma\": close > SMA(slow) for uptrend, close < SMA(slow) for downtrend\n\nUse as a gate to block entries against the trend.",
  "properties": {
    "direction": {
      "enum": [
        "uptrend",
        "downtrend"
      ],
      "title": "Direction",
      "type": "string"
    },
    "fast_period": {
      "default": 20,
      "maximum": 400,
      "minimum": 2,
      "title": "Fast Period",
      "type": "integer"
    },
    "indicator": {
      "default": "ema_cross",
      "enum": [
        "ema_cross",
        "price_vs_ma"
      ],
      "title": "Indicator",
      "type": "string"
    },
    "mode": {
      "default": "level",
      "description": "Firing mode: 'level' = true every bar the regime condition holds (CompareCondition). 'cross_in' = edge, fires once on the bar the regime activates (cross into the trend). 'cross_out' = edge, fires once on the bar the regime deactivates (cross out of the trend).",
      "enum": [
        "level",
        "cross_in",
        "cross_out"
      ],
      "title": "Mode",
      "type": "string"
    },
    "slow_period": {
      "default": 50,
      "maximum": 800,
      "minimum": 2,
      "title": "Slow Period",
      "type": "integer"
    },
    "symbol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Reference symbol for regime data (e.g. 'SPY'). None = primary traded symbol.",
      "title": "Symbol"
    },
    "type": {
      "const": "regime_filter",
      "default": "regime_filter",
      "title": "Type",
      "type": "string"
    }
  },
  "required": [
    "direction"
  ],
  "title": "RegimeFilterCondition",
  "type": "object"
}
