Attempting to place order for SBIN - Buy 1 stop loss 825 price 830.25. Error placing order for SBIN: Trigger price for stoploss buy orders should be higher than the last traded price (830.25). I'm trying to place a buy order with a stop loss but it gives this error can someone help My current code if order_type == "Buy": order_id = kite.place_order( variety=kite.VARIETY_REGULAR, exchange=exchange, tradingsymbol=trading_symbol, transaction_type=kite.TRANSACTION_TYPE_BUY, quantity=quantity, order_type=kite.ORDER_TYPE_SLM, # or LIMIT if you specify a price product=kite.PRODUCT_MIS, # or CNC for delivery trigger_price=stop_loss # This is the stop-loss for Buy )
As the error message indicates one can place a stoploss order above last price. If you need to place an orer below last price then you need to use limit order type. You can know more about the stoploss orders here.
Let's say i placed a CO order with buy at 830 and SL-M trigger at 825. now i want to modify the trigger, if i place a modify request on trigger order which is the second leg of the CO order, it gives error as "The stop loss trigger price is beyond the allowed range of 10%. Try a price within the range." and if i place modify request on parent order_id it gives error as Error updating trailing stop loss for SBIN: Order cannot be modified as it is being processed. Try later. Code of modification on second leg of co order return_of_modify = kite.modify_order( order_id=order['order_id'], variety=kite.VARIETY_CO, trigger_price=new_stop_loss )
Code of modification on parent of order return_of_modify = kite.modify_order( order_id=order['parent_order_id'], variety=kite.VARIETY_CO, trigger_price=new_stop_loss )
I am too facing the same problem, but when I explored more about CO, what I came to know is you can use exit_order function to exit the order at market price. As it is not allowing to modify the order to new SL price, you may run this code when the new SL price point is reached, it will exit at the new SL.
I have one question, in your code how did you get the value of order_id of second leg (SL order) Thanks
Code of modification on second leg of co order
return_of_modify = kite.modify_order(
order_id=order['order_id'],
variety=kite.VARIETY_CO,
trigger_price=new_stop_loss
)
Code of modification on parent of order
return_of_modify = kite.modify_order(
order_id=order['parent_order_id'],
variety=kite.VARIETY_CO,
trigger_price=new_stop_loss
)
what should i do udate trigger on cover order
I am too facing the same problem, but when I explored more about CO, what I came to know is you can use exit_order function to exit the order at market price. As it is not allowing to modify the order to new SL price, you may run this code when the new SL price point is reached, it will exit at the new SL.
I have one question, in your code how did you get the value of order_id of second leg (SL order)
Thanks