Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order is in a state that prohibit using it as a compound leg

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

    Order is in a state that prohibit using it as a compound leg

    I have a strategy that needs to modify orders quickly. It is running on each tick. Often I get the following error in fast moving markets when it modifies a limit Buy or Sell order with SetProfitTarget and SetStopLoss.

    Order is in a state that prohibits using it as a compound leg. Affected Order: Sell 1 Limit @ 6015.75
    How do I prevent this error or double check for it?
    How do I determine if it is profit Target or the Stop loss order that is causing it?

    I have already set RealtimeErrorHandling = RealtimeErrorHandling.IgnoreAllErrors
    and I am double checking my entry order modification like so below



    Code:
    private bool IsSameOrderPrice(Order entryOrder, double newPrice)
    {
    // Check if the order is not null and is in a working state
    if (entryOrder == null || entryOrder.OrderState != OrderState.Working)
    {
    return false; // No valid order exists
    }
    
    // Compare the current limit price with the desired new price
    return entryOrder.LimitPrice == newPrice;
    }​
    
    
    _entryLimitOrder = EnterLongLimit(PosSize, entryPrice, EntryLimitLongName);
    
    SetProfitTarget(EntryLimitLongName, CalculationMode.Price,targetPrice);
    SetStopLoss(EntryLimitLongName, CalculationMode.Price,stopPrice,true);​

    #2
    Hello cutzpr,

    This error may be indicating the profit target is being filled before the stop loss can be accepted.

    Note, Set methods are intended to be called before calling an entry order method.

    Please see the forum post linked below.


    May I confirm the targetPrice variable is at least a few ticks greater than the current bid at the exact moment the SetProfitTarget() method is called?
    May I confirm the stopPrice variable is at least a few ticks lower than the current bid at the exact moment the SetStopLoss() method is called?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea,

      Thank you for your responce. I placed the TP and SL before the entry order to see if it would solve the issue. If it doesn't I will dive a bit deeper.

      Comment


        #4
        Hello cutzpr,

        May I confirm the targetPrice variable is at least a few ticks greater than the current bid at the exact moment the SetProfitTarget() method is called?
        May I confirm the stopPrice variable is at least a few ticks lower than the current bid at the exact moment the SetStopLoss() method is called?​
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea,
          The targetPrice and the stopPrice variable were one tick away from its currents current price when I was trying to modify the order. But it seems place the set methods before the modification of the entrylimit price and order fixed the issue.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          55 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          37 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          17 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          19 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          49 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X