Stoploss and Target Order

Can we have stoploss and Target order open at the same time? Do we need extra margin for this? Can’t use bracket order because it only supports limit/market order currently for the entry leg. Will enter using trigger order and then place the stoploss and target orders.

Hello @Ritesh_Srivastava

You can use Forever Order for this, to have Stoploss and Targer Order both, via OCO. The order stays on Dhan side, so there is no margin blocked until the order is triggered.

Thanks @Hardik , can you please share an example payload for triggering OCO orders using api.

Forever order is only for holding stock. If we want same day stop loss and target after buying in delivery.

Are you using Python Library or the REST API endpoints itself?

@Mudabbir_Hasnain yes, it is true for equity. For F&O, it can be placed on the same day.

Using the python library.

forever = dhan.place_forever(
    security_id=1333,
    exchange_segment=dhan.NSE,
    transaction_type=dhan.SELL,
    product_type=dhan.CNC,
    order_type=dhan.LIMIT,
    quantity=10,
    price=1000,
    trigger_price=1050,
    order_flag="OCO",
    validity="DAY",
    price1=1200,
    trigger_price1=1250,
    quantity1=10
)

Hi @Hardik in case of Product Type “CNC” can the validity be “DAY” for options?

How to place normal orders for options not intraday through api? When I am trying dhanhq.CNC it’s using delivery orders

@Hardik : can you please look into my query.

Hi @Hardik

Could you please help with the below requirement in pyhton?
I need to place order at market price with StopLoss & Profit in %.

Hello @Ritesh_Srivastava @Rahul_Singh4

You can use MARGIN as product type for this.

Stop Loss and Profit will be input at value only, since the API takes input in that way. You can keep the percentage calculation at your end.