Can I change stoploss after first leg execution

I place orders and there is range at which the orders can be executed in real time. I want to modify the stoploss only when the first leg of the BO is executed. Meaning I will need to change the trigger price for stoploss
Can I do the same?
  • botany02
    Yes You can Modify Trigger Price of Stoploss Order as well as Limit Price of Target Order.
    Note, Stoploss & Target Order will be placed by OMS only after your First leg Order status is COMPLETE.
    If first leg Order is OPEN, then no Sl & Tgt Order will be placed till 1st Leg Order Status changes to COMPLETE.
  • botany02
    botany02 edited October 2016
    To Modify Sl or Tgt Order
    Send PUT Request[SL or TGT OrderId]
    / api_key
    / access_token
    / tradingsymbol
    / exchange
    / parent_order_id 'First Leg OrderId
    / price 'Only Required For Target Order Modification
    / trigger_price 'Only Required For SL Order Modification
  • RH1558
    Thanks Botany :). Today I had sold BEL OCT FUT at 1286.85 (SL-1293.15 - difference of 6.3 points). But the order got executed at 1286.05 - and thereby automatically the stoploss changed to 1292.35- Resulting in a loss for me.
    So I now plan to modify the order once the parent order is complete, now in my case the difference in points will be 7.1 instead of 6.3 as the order execution happened lower than I wanted.

    Would this work? Can I send a parameter trigger_price to change a executed BO with the parent order ID?
  • botany02
    Normally , this happens in BO as Ist Leg Order may execute at any price due to fluctuations
    and SL & Tgt Prices calculated from Executed Price of 1st Leg.
    You can modify the SL price once the Order is placed by OMS.

    Below is the Example
    Parent Order Id = 15897890001
    Sl Order Id = 15897890002

    --Request PUT --
    / api_key = xxx
    / access_token = xxx
    / tradingsymbol = BEL16OCTFUT
    / exchange = NSE
    / parent_order_id = 15897890001
    / trigger_price = 1293.15

    Above request will modify your SL Trigger Price From 1292.35 to 1293.15
  • RH1558
    Great, Thanks a ton Botany, btwn - the price parameter-which is mandatory, what should be its value? Should it be same as that of trigger price or more or zero?
    Sorry for the trouble and thanks and advance
  • botany02
    You can Put 0 to Non Applicable Fields
    Like, in Sl Order Modification Put 0 for Quantity & LimitPrice
    vice-versa for Tgt Order Modification
  • RH1558
    Hi @botany02 / @vivek
    Sorry to open the discussion again, & again seeking your help, I was busy and couldnt trade.
    While modifying orders with the parameters*********&access_token=*********&parent_order_id=161108000058758&quantity=0&price=0&trigger_price=1932.85

    I am getting the error : HTTP STATUS CODE500 MODIFY ORDER REPLY JSON : {"status": "error", "message": "An internal server error occurred", "error_type": "GeneralException"}

    Can you please suggest what am I doing wrong
  • botany02

    You are missing two parameters

    Add & Try
  • RH1558
    This was for AjanthaPharma NOV Future for today
  • RH1558
    Oh Yes, thanks for the quick response, really appreciate it. @botany02 t
    Will try again and inform back

    Kind Regards
  • lazydragonfist
    When I am trying to Modify Stoploss and Target I am getting Success Response but not Reflecting in Order .

    {'parent_order_id': u'171026001462580', 'product': 'NRML', 'order_type': 'LIMIT', 'exchange': 'NSE', 'access_token': u'klsjflkasdjf;laksjd;lfkasjd;flkasjl', 'price': 380, 'trailing_stoploss': '', 'stoploss_value': 0, 'validity': 'DAY', 'transaction_type': 'SELL', 'trigger_price': 0, 'order_id': u'171026001462632', 'tradingsymbol': 'SBIN', 'api_key': u'asdfasdfadsfsa', 'squareoff_value': 0, 'quantity': 1}
    {"status": "success", "data": {"order_id": "171026001462632"}}

    {'parent_order_id': u'171026001462580', 'product': 'NRML', 'order_type': 'LIMIT', 'exchange': 'NSE', 'access_token': u'klsjflkasdjf;laksjd;lfkasjd;flkasjl', 'price': 0, 'trailing_stoploss': '', 'stoploss_value': 0, 'validity': 'DAY', 'transaction_type': 'SELL', 'trigger_price': 245, 'order_id': u'171026001462633', 'tradingsymbol': 'SBIN', 'api_key': u'asdfasdfadsfsa', 'squareoff_value': 0, 'quantity': 1}
    {"status": "success", "data": {"order_id": "171026001462633"}}
  • sujith
    Hi @lazydragonfist,
    Please create a new thread for new queries.
    If someone else has the same issue/doubt then they can search and find the answer.
    If I answer here, it gets buried and unsearchable.
This discussion has been closed.