Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Internal Order Handling Rules

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

    Internal Order Handling Rules

    Hi,

    Well, I have gone through the posts in the forum and I still am not clear. This still seems to be an area of confusion since 2009. Perhaps someone can clarify this for me.

    I am testing a strategy in which I wish to do the following:

    if(long entry conditions)
    longEntryOrder = EnterLongStop(0, true, 1, High[0] + TickSize, Instrument.FullName);

    if(short entry conditions)
    shortEntryOrder = EnterShortStop(0, true, 1, Low[0] - TickSize, Instrument.FullName);

    and of course I am hitting the order handling message:
    6/21/2011 5:37:58 PM Strategy An Enter() method to submit an entry order at '1/5/2011 5:15:00 AM' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.

    This seems odd to me. Yes, I have two entries in opposite directions but they have not been triggered. Why is the strategy complaining? And, more importantly, how do I fix this? Any help would be greatly appreciated. Thank you.


    #2
    Hi Zeos6,

    Below highlighted the rule you're running into. You can find all internal order handling rules here.

    Methods that generate orders to enter a position will be ignored if:
    The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction

    You can't submit enter statements in opposing directions at same time. You can use an unmanaged strategy which has no rules or position management, or simulate one of those orders. You check market price compared to desired stop price and submit a market order when equal.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your quick reply Ryan. Now, in English please. :-)

      My understanding was that I was not submitting the entries until one of the conditions (i.e. either long or short criteria) was met and then I was submitting only one order. From your response it appears that you are saying that both entries are submitted regardless of the conditionals. Is this correct?

      If yes, the situation is sligtly more complex because I already do in a manner of speaking what you suggested. In fact I have...


      if(longSignal)
      {
      if(null == longEntryOrder)
      {
      longEntryOrder = EnterLongStop(0, true, 1, High[0] + TickSize, Instrument.FullName);
      barNumberOfOrder = CurrentBar;
      }
      }

      and likewise for the short entry.

      Now, the only way the error could arise if I acuallu have an order aactive and a second order comes along. If this is a case, I tried modifying the code to read,

      if(longSignal)
      {
      if(null == longEntryOrder)
      {
      CancelOrder(shortEntryOrder);
      longEntryOrder = EnterLongStop(0, true, 1, High[0] + TickSize, Instrument.FullName);
      barNumberOfOrder = CurrentBar;
      }
      }
      but this created error messages.

      So, if this is the situation, how can I force orders to be OCO?
      Last edited by Zeos6; 06-21-2011, 04:52 PM.

      Comment


        #4
        If you did not submit both those orders at the same time, then you wouldn't run into internal order rules. Rules are only affected during order submission. They won't happen if your strategy only contains the order methods.

        It could be some other part of your strategy or a different rule. I suggest simplifying and reviewing the link on the other ways you can trigger these rules.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thanks for the reply Ryan. I am not disputing that I may have an active but yet unfilled order pending. The question thus becomes, why does the CancellOrder before the new entry not take place immediately and why do I get an error message on compilation?
          I have managed to get rid of the error by checking for the existence of an open order but the Enter() ignored message still persists. I think because the CancelOrder is not takin geffect immediately. Is there a way to check if the CancelOrder() has executed?
          Last edited by Zeos6; 06-21-2011, 05:12 PM.

          Comment


            #6
            Right - you need confirmation that the order is cancelled before submitting the order. Yes, order state can be monitored if you use IOrder.

            protected override void OnOrderUpdate(IOrder order)
            {
            if (entryOrder != null && entryOrder == order)
            {

            if (order.OrderState == OrderState.Cancelled)
            //It's possible to submit orders from right here.
            }
            }
            Last edited by NinjaTrader_RyanM1; 06-22-2011, 09:26 AM.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Thanks Ryan. I already use IOrder as you indicated and I set entryOrder to null when order state is filled, cancelled or rejected.

              I have figured it out. Thanks for your help.
              Last edited by Zeos6; 06-22-2011, 09:21 AM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              656 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              371 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              109 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              574 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              579 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X