How to place STOP LOSS and TAKE PROFIT via API for intraday positions?

Hi,
I’m a beginner here and trying to explore the API, I kindly request someone to help me out to place OCO order or workaround to OCO.
I’m able to place an intraday MARKET BUY order and also set StopLoss using intraday SL order, but unable to figure out how to place TP for this position.

Thanks in advance

@Upstox , could anyone please help me out?

Hi! To find out what I can do, say @upstox display help.

For this currently there is no API. But work around is that you place buy order and SL order and then keep monitoring LTP through websocket once it hit your target update SL order with your target price or trail SL to nearest target so that you can get max profit if price move in your direction.

1 Like

@Jagdish_j_ptl Thanks for your assistance. @Kiran_Raj You need to place the second leg of the limit order opposite to your first (if your first leg is a buy, then sell, and vice versa).

This process will be easy once we introduce the GTT order, which is currently in the pipeline. I don’t have an ETA for it at this moment.

1 Like

I am also facing this issue, with SL-M order the issue is for some instrument , it does not allow SL-M orders , so in F&O, its really an issue, can some help me out how to exit a position if buy a option premium CE or PE. or set a stop loss for my present open position for CE or PE

but when you have bought a premium of a option and you go with a new order for selling it upstox mobile application it demands a very high margin, and considers it a fresh order instead or squaring off a open position, will it not be the case in upstox api. please kindly explain, really struggling with it, as i am unable to place SL-M order for some instrument, as it says SL-M order not allowed for certain instrument.