How to set SL/TP on algo entries now that CO & BO are deprecated?

My algo places the following order types via fyers-apiv3 (productType: INTRADAY) on NIFTY options:

  • Entry: type 1 (LIMIT) or type 2 (MARKET), BUY
  • Exit attempt: type 1 (LIMIT), type 3 (SL-M), or type 4 (SL-L), SELL — placed as a separate order after entry

Now that CO & BO are deprecated, how do I set an SL and TP when entering a position via the algo? Placing the SL/TP as an independent SELL order after entry gets rejected with a margin shortfall, as if it were a fresh naked short rather than an exit on my existing long. Is there any API-side mechanism to attach or rest a proper SL/TP on an algo-placed position now, or is monitoring price myself and firing a plain sell only once triggered the only option?

Hi Vijay,

You can now include the take‑profit and stop‑loss values directly in the payload. Previously, the stopLoss or takeProfits keys only worked with ProductType CO/BO; now they work with any product type (INTRADAY, CNC, MARGIN, MTF). Ref to the doc for more details: API - FYERS

Hi Naresh,

Thanks for confirming stopLoss/takeProfit now work with INTRADAY. Tested it today and placing the order worked fine. Just to add what I tested, when placing a resting order first time I can set the SL, Entry and TP in the payload. Subsequent changes that worked, before the resting order is fulfilled are

  • modify order with changes only for SL, TP or both without changing the entry price worked
  • modify only entry price, without changing the SL and TP worked
  • modify order with all - SL, entry and TP - only changed the entry and dropped making any changes to SL & TP.

Hope this in line with how it is designed to work. Yet to test it for a live order but I guess once in a position I can keep ratcheting the SL & TP using the modify order.

Let me know if my understanding of how this works is correct.

Regards

Hi Naresh,

Follow-up on stopLoss/takeProfit (INTRADAY) — works great pre-fill, fails post-fill

Confirmed the stopLoss/takeProfit fields work as described on productType: INTRADAY — placed, ratcheted, and cancelled a resting LIMIT order’s bracket multiple times with no issues while it was still pending.

However, once that same order fills (becomes a position), calling modify_order on the same order id to attach/change stopLoss/takeProfit is rejected with:

"Not a pending order"

This happened on a live order that filled in ~8 seconds — tried to set the bracket ~2 minutes after fill, same order id, same unchanged limitPrice, just added stopLoss/takeProfit. Rejected outright.

Is there a different call or parameter meant for attaching/modifying a bracket on an already-filled position (not the originating order), or is stopLoss/takeProfit strictly a placement-time-or-while-pending feature with no post-fill path at all? Want to know if I’m missing an endpoint or if this is just how it’s designed to work.