Skip to content
Cirrus home
Sign in

Guide

Entry trigger with a bracket

Wait for a price or condition to enter, then manage the trade with a target, a stop-loss and a trailing stop.

A bracket trigger can wait for an entry condition. When it holds, the entry price becomes that tick’s price and the target and stop-loss take over. Needs the triggers scope.

POST
curl -X POST "https://cirrus.pocketful.in/v2/triggers" \
  -H "Authorization: token $CIRRUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "account": "P1",
    "kind": "bracket",
    "legs": [
      {
        "instrument_token": "CT:TEST:RELIANCE",
        "side": "BUY",
        "quantity": 5,
        "product": "MIS"
      }
    ],
    "spec": {
      "entry": {
        "when": "ltp >= 2520"
      },
      "target": {
        "when": "ltp >= entry_px * 1.02"
      },
      "stop_loss": {
        "init_sl": "entry_px - 25",
        "trail": {
          "step": "5"
        }
      }
    }
  }'

What happens #

  1. The trigger waits (pending) until entry.when holds.
  2. entry_px becomes that tick’s last price; the trigger is active.
  3. The stop starts at init_sl and moves up by step as the price rises. It never loosens.
  4. Target hit (target_hit) or stop hit (sl_hit): everything is exited at market.

Follow every step of a trigger (armed, entered, stop moved, exited) with GET /v2/triggers/{trigger_id}/journey.

In the reference