Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Double Stop Loss Order Submittal Resulting in Unintended Entry

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Double Stop Loss Order Submittal Resulting in Unintended Entry

    I considered posting this to Tech Support, but decided to post here. I had a code malfunction today needing manual handling, which I always want to avoid. I had a scenario where my stop loss order was triggered, and entered the order queue "working." There was an in-process volatility/volume spike in CL, forcing a fairly large amount of slippage. I am confident OnBarUpdate was triggered during the working time due to the fill price. What I need to know is this: if SetStopLoss is called in OnBarUpdate and if there is a working stop loss order while OnBarUpdate is called, will another be submitted? Is this working as intended? Or did I actually force it to happen in my code?

    I have this code placed in OnExecutionUpdate, intended to reset stop loss orders to its default value once executed. This seems like a likely culprit. Would this cause this to happen?

    Code:
    if (execution.Order.Name == "Stop loss")
    {
    SetStopLoss("", CalculationMode.Ticks, stoplosss, true);
    shiftstop = false;
    trailingstop = false;
    considerexit = false;
    }
    stoplosss = System.Convert.ToInt32(stoploss * atrbalance * SMAatr[0]);

    #2
    Hello liquid150 ,

    if SetStopLoss is called in OnBarUpdate and if there is a working stop loss order while OnBarUpdate is called, will another be submitted?
    If you have a working stoploss it should update the existing order if the same fromEntrySignal is used.

    I have this code placed in OnExecutionUpdate, intended to reset stop loss orders to its default value once executed. This seems like a likely culprit. Would this cause this to happen?
    That could be, can you explain further what this is intended to do?

    Right now, if the order "Stop loss" has an execution event, it will try to submit a stop loss. If there was an existing order it would try to update it however if you did this for a fill I am not certain what the result of that would be offhand.

    Are you trying to reset the stoplosss price which is used for the next stop order that will be submitted sometime in the future? If so, you likely just need to remove the SetStopLoss line, that would only be used to initially submit/update working orders.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello liquid150 ,



      If you have a working stoploss it should update the existing order if the same fromEntrySignal is used.
      Okay so just to confirm, this is "Working" state meaning working in order queue, yes? If so then I think the posted code is the issue.


      Originally posted by NinjaTrader_Jesse View Post
      That could be, can you explain further what this is intended to do?

      Right now, if the order "Stop loss" has an execution event, it will try to submit a stop loss. If there was an existing order it would try to update it however if you did this for a fill I am not certain what the result of that would be offhand.

      Are you trying to reset the stoplosss price which is used for the next stop order that will be submitted sometime in the future? If so, you likely just need to remove the SetStopLoss line, that would only be used to initially submit/update working orders.

      I look forward to being of further assistance.
      Yes, I am resetting stoplosss price for use in the future, along with all the booleans which can potentially affect it.

      Comment


        #4
        Hello liquid150,

        Okay so just to confirm, this is "Working" state meaning working in order queue, yes?
        Correct, the order state will literally say "working".

        It sounds like have likely narrowed in on the problem, if the intention is just to reset the price/variables for the future the SetStopLoss is not needed there. You only need to call SetStopLoss if you want to submit an order or update one, for example you could make a trailing stop by calling this with new prices.

        If that ends up not being the problem, please let me know and we can continue to look into it.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by MatthewLesko, Today, 09:55 PM
        0 responses
        1 view
        0 likes
        Last Post MatthewLesko  
        Started by t.kelly4149, Today, 05:36 PM
        1 response
        9 views
        0 likes
        Last Post bltdavid  
        Started by SilverSurfer1, Today, 06:29 PM
        0 responses
        19 views
        0 likes
        Last Post SilverSurfer1  
        Started by trader3000a, Today, 01:06 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by marcus2300, Today, 11:45 AM
        3 responses
        31 views
        0 likes
        Last Post marcus2300  
        Working...
        X