How to place stop loss and target(exit price) for intraday order

Kamalv
I am using below code snippet for placing order. My expectation is, below code snippet it will place intraday order with Target (exit price) & stop loss but this is not reality.

order_id = kite.place_order(tradingsymbol = 'TATAMOTORS',
exchange = kite.EXCHANGE_NSE,
transaction_type = kite.TRANSACTION_TYPE_BUY,
quantity = 1,
order_type = kite.ORDER_TYPE_LIMIT,
product = kite.PRODUCT_MIS,
variety = kite.VARIETY_REGULAR,
price = 296.4,
squareoff = 298.6,
trigger_price = stop_loss - 1,
stoploss = 293.4)

Can you help me to place "stop loss and target (exit price)" for intraday with API?
  • sujith
    sujith edited January 2021
    The field stoploss field is only used for bracket order.
    You need to place a stoploss limit order with price and trigger price.
  • Kamalv
    I am selecting API parameters as per zerodha manual trade. Please find attached screenshot.

    I am going to use below code snippet for placing a buy order, stop loss and target price. Could you verify and feel free to correct if anything wrong (I'm new to API trading hope you don't mind).

    #Place Order
    order_id = kite.place_order(tradingsymbol = 'TATAMOTORS',
    exchange = 'NSE',
    transaction_type = 'BUY',
    quantity = 1,
    product = 'MIS',
    variety = 'regular',
    order_type = 'LIMIT',
    price = 296.4)

    #Stop Loss
    sl_order_id = kite.place_order(tradingsymbol = 'TATAMOTORS',
    exchange = 'NSE',
    transaction_type = 'SELL',
    quantity = 1,
    product = 'MIS',
    variety = 'regular',
    order_type = 'SL',
    trigger_price = 292.4,
    stoploss = 293.4)

    #target_order
    exit_order_id = kite.place_order(tradingsymbol = 'TATAMOTORS',
    exchange = 'NSE',
    transaction_type = 'BUY',
    quantity = 1,
    product = 'MIS',
    variety = 'regular',
    order_type = 'LIMIT',
    price = 298.4)
  • sujith
    You need to add validity to all orders.
    The limit orders seem fine, you will have to remove stoploss from SL order and use price.
This discussion has been closed.