Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trying to understand why Some Orders are ignored

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

    Trying to understand why Some Orders are ignored

    I am getting an error message for some orders (many others are submitted OK):
    2023-05-02 00:37:32:479 ERROR: Strategy 'BWAA1/-1': An Enter() method to submit an entry order at '04/14/2023 15:59:59' has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation.
    Debugging and tracing the specific order, I don't see any issue:
    1. Position is Flat
    2. Stop is set with SetStopTarget
    3. Target is set with SetStopTarget
    4. Order was sent using EnterShortMIT

    here are the details:
    4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='ES@197-Short' Mode=Price Value=4175 IsSimulatedStop=False IsMarketIfTouched=False

    4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='ES@197-Short' Mode=Price Value=4172.5 IsSimulatedStop=False IsMarketIfTouched=False

    BWAA1/ES:SOrder.New@196- 04/14 15:59:59, OpenQty=0, Position=Flat, Name=ES@197-Short, Type=MIT, Qty=1, priceEnter=4174.75, priceStop=4175.00, priceTarget=4172.50

    4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Entered internal SubmitOrderManaged() method at 4/14/2023 3:59:59 PM: BarsInProgress=0 Action=SellShort OrderType=MIT Quantity=1 LimitPrice=0 StopPrice=4174.75 SignalName='ES@197-Short' FromEntrySignal=''

    4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Ignored SubmitOrderManaged() method at 4/14/2023 3:59:59 PM: BarsInProgress=0 Action=SellShort OrderType=MIT Quantity=1 LimitPrice=0 StopPrice=4174.75 SignalName='ES@197-Short' FromEntrySignal='' Reason='An Enter() method to submit an entry order has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation.'
    Strategy 'BWAA1/-1': An Enter() method to submit an entry order at '04/14/2023 15:59:59' has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation.

    4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Cancelled expired order: BarsInProgress=0, orderId='NT-00933-3545' account='Backtest' name='ES@196-Long' orderState=Working instrument='ES 06-23' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=4170.75 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-04-14 15:41:00' gtd='2099-12-01' statementDate='2023-05-02'
    Looking at the NT8 help guide of Managed Approach->Internal Order Handling Rules that Reduce Unwanted Positions https://ninjatrader.com/support/help...tml?cs1061.htm I dont see any relevant situation as the position is closed except the point I marked in bold. I don't understand the point.

    Can you help explain the point and possibly help understand my specific issue?

    The following rules are true per unique signal name:

    Methods that generate orders to enter a position will be ignored if:
    • A position is open and an order submitted by a non market order exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
    • A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
    • A position is open and two or more Entry methods to reverse the position are entered together. In this case the second Entry order will be ignored.
    • 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
    • The entry signal name is not unique

    Methods that generate orders to exit a position will be ignored if:
    • A position is open 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
    • A position is open and an order submitted by a set method (SetStopLoss() for example) is active

    Set() methods that generate orders to exit a position will be ignored if:
    • A position is open 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
    • A position is open and an order submitted by a non market order exit method (ExitLongLimit() for example) is active

    #2
    It sounds like, if I am understanding you correctly, you're trying to do a bracket breakout e.g. go long at market if > X but go short at market if < Y. You cannot do that with managed orders - if you're going to stick with managed orders you need to do something like only put one side or the other in the market then if price moves closer to the other side, cancel that and put the other side in. Or, you could switch to unmanaged orders. Managed orders cannot be used with an active long entry order and an active short entry order at the same time.

    If that's not what you're trying to do and you're just trying to go short, check the situation with either Print() statements or by examining the Performance Report and looking at the orders to see if you have an open order still hanging out there on the other side that you don't know about.

    Edit: actually, reading your post again, it can be clearly seen you have both a long and a short MIT order out there because they're referenced in the log where the long is canceled after the short is rejected. You can't do that with managed orders. You'll have to take one of the approaches described above instead.
    Last edited by QuantKey_Bruce; 05-02-2023, 05:13 AM.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Hello Shai Samuel,

      Thank you for your post.

      It does seem like you are violating the order handling rule that you put in bold:
      • 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
      ​As Bruce mentioned, with the managed approach you may not have two working entry orders that are set up for entries in opposite directions. It appears that you have both an EnterLongMIT and an EnterShortMIT order in place at the same time. Due to the risk of both entries potentially filling, the managed approach ignores the second order to prevent unwanted positions. You will have to modify your logic so that there are not two entry orders in opposite directions at the same time to prevent any orders being ignored.

      Please let us know if we may be of further assistance.

      Comment


        #4
        Thank you to both Bruce and Emily. for your replies.

        As you can see above, the data for my orders is Market is Flat, but yes, the previous order was in the other direction, and wasn't filled yet.

        I guess if I would like to go with "ES@197-Short​" in this situation, I need first to Cancel "ES@196-Long​", using CancelOrder.

        ES@196-Long
        1. 4/14/2023 3:41:00 PM Strategy 'BWAA1/-1': Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='ES@196-Long' Mode=Price Value=4170.5 IsSimulatedStop=False IsMarketIfTouched=False
        2. 4/14/2023 3:41:00 PM Strategy 'BWAA1/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='ES@196-Long' Mode=Price Value=4173 IsSimulatedStop=False IsMarketIfTouched=False
        3. 4/14/2023 3:41:00 PM Strategy 'BWAA1/-1': Entered internal SubmitOrderManaged() method at 4/14/2023 3:41:00 PM: BarsInProgress=0 Action=Buy OrderType=MIT Quantity=1 LimitPrice=0 StopPrice=4170.75 SignalName='ES@196-Long' FromEntrySignal=''
        4. 4/14/2023 3:41:00 PM Strategy 'BWAA1/-1': Cancelled expired order: BarsInProgress=0, orderId='NT-00932-3545' account='Backtest' name='ES@195-Long' orderState=Working instrument='ES 06-23' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=4168.25 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-04-14 15:31:08' gtd='2099-12-01' statementDate='2023-05-02'

        ES@197-Short
        1. 4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='ES@197-Short' Mode=Price Value=4175 IsSimulatedStop=False IsMarketIfTouched=False
        2. 4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='ES@197-Short' Mode=Price Value=4172.5 IsSimulatedStop=False IsMarketIfTouched=False
        3. 4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Entered internal SubmitOrderManaged() method at 4/14/2023 3:59:59 PM: BarsInProgress=0 Action=SellShort OrderType=MIT Quantity=1 LimitPrice=0 StopPrice=4174.75 SignalName='ES@197-Short' FromEntrySignal=''
        4. 4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Ignored SubmitOrderManaged() method at 4/14/2023 3:59:59 PM: BarsInProgress=0 Action=SellShort OrderType=MIT Quantity=1 LimitPrice=0 StopPrice=4174.75 SignalName='ES@197-Short' FromEntrySignal='' Reason='An Enter() method to submit an entry order has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation.'
        5. Strategy 'BWAA1/-1': An Enter() method to submit an entry order at '04/14/2023 15:59:59' has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation.
        6. 4/14/2023 3:59:59 PM Strategy 'BWAA1/-1': Cancelled expired order: BarsInProgress=0, orderId='NT-00933-3545' account='Backtest' name='ES@196-Long' orderState=Working instrument='ES 06-23' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=4170.75 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-04-14 15:41:00' gtd='2099-12-01' statementDate='2023-05-02'

        Comment


          #5
          Yes that is correct. Only one direction at a time.
          Bruce DeVault
          QuantKey Trading Vendor Services
          NinjaTrader Ecosystem Vendor - QuantKey

          Comment


            #6
            Hello Shai Samuel,

            For a breakout, the unmanaged approach may be better suited.

            Below is a link to an example.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi,

              Revisiting the issue, I noticed that the time 15:59:59, which is EOD in the system timezone.

              I added a limit to avoid entering orders for certain seconds before EOD, the error was gone.

              Comment


                #8
                DAY time-in-force orders do expire when the session ends (or you could enter them as GTC), but you still cannot enter both long and short using managed orders at the same time. You would need to use unmanaged orders to do a bracket breakout, or alternatively, cancel one side and put on the other side when price gets closer to one side or the other of the bracket.
                Bruce DeVault
                QuantKey Trading Vendor Services
                NinjaTrader Ecosystem Vendor - QuantKey

                Comment


                  #9
                  Hi Shai Samuel. Have you coded your breakout strategy with the Unmanaged Approach? I'm trying to code exact same logic on my own but struggling with this approach.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Yesterday, 05:17 AM
                  0 responses
                  56 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  133 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  73 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  45 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  49 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X