Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order ignored?

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

    Order ignored?

    I get the following output when running Strategy Analyzer:
    Code:
    An Enter() method to submit an entry order at '9/22/2022 6:11:24 PM' has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation.


    I'm not understanding the detailed explanation. Was it a duplicate order? My strategy oscillates between a long and short position.

    I would open a long with a profit target and stop loss. Either way the position will close. If neither profit target or stop loss happens on a short signal it will reverse the position.

    So I am finding it hard to see how a duplicate order happened.

    I also plot on the chart when an order is issued. Sure enough at that datetime an order was issued but was ignored by NT. The order is intentional as it follows the strategy rules.

    How can I prevent this from happening? The system can't really be smart enough to infer unintentional orders can it?

    FYI, the sequence was:
    1. A Buy order was issued on bar 1
    2. Buy order was filled on bar 2
    3. A sell order was issued on bar 3 but was ignored, resulting in a stop loss hit. Had the sell order not been ignored, this would be a simple reverse and not incurred the stop loss.

    Many Thanks, Caesar.

    Attached Files

    #2
    Hello Skechers,

    Thanks for your post.

    This error message indicates that an order was ignored because your strategy violates the Managed Approach Internal Order Handling Rules.

    One example of when this could occur is if you are using both Set methods in the Stops and Targets screen and Exit methods in the Conditions and Actions screen. You would need to use Set methods OR Exit methods, not both.

    Another example of this is if your strategy had a limit order for 1 contract working as a Profit Target, but then your strategy was also programmed to reverse the position at the price very close to the target limit order, then submitting both orders can be risky, since it could lead to a larger position than the strategy is designed to enter if both orders got filled in quick succession by the exchange.

    Please review the Managed Approach Internal Order Handling rules on the help guide page linked below and modify your strategy accordingly so that it does not violate any of the Internal Order Handling Rules.

    Managed Approach Internal Order Handling Rules: https://ninjatrader.com/support/help...antedPositions

    Let me know if I may assist you further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi Brandon,

      I am definitly using SetProfitTarget SetStopLoss and Exit. Depending on the calculation I need to close the position. If Exit is not the correct way, what should I use? Is there a Position object I can call Position.ClosePosition() on? Or should I disable SetProfitTarget(0)/StopLoss(0) before calling Exit?

      If you look at the chart, the Sell order is ignored on the next bar immediately after a Buy order. It's a perfectly valid order, not anywhere near a profit target/stop loss. Because the Sell/Short order is ignored, the Long position goes into a stop loss. It would have otherwise yielded a profit target. This is not an acceptable behavior.

      How can I avoid this situation too?

      Many Thanks, Caesar.

      Comment


        #4
        Hello Skechers,

        Thanks for your note.

        To avoid this error your would need to modify your strategy to use either Set methods or Exit methods.

        If there are multiple conditions for placing an exit order, then you should consider removing the Set methods and only using Exit methods in your strategy.

        Please see the attached example script demonstrating using Exit methods in the Strategy Builder to place stop loss and profit target orders.

        To understand exactly how your strategy is behaving and processing logic, debugging prints should be added to the script.

        Below is a link to a forum post that demonstrates how to use prints to understand behavior.

        https://ninjatrader.com/support/foru...121#post791121

        Let me know if I may further assist.
        Attached Files
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Hello Brandon,

          This seems rather kludgy. Is there a way I can do EnterLong( limit, stop loss ) so that way I don't have to worry about Set or Exit.

          TradeStation does this today.

          I would prefer not to restructure my code.

          Many Thanks, Caesar.

          Comment


            #6
            Hello Skechers,

            Thanks for your note.

            There is no Entry method overload that allows you to specify a profit target and stop loss parameter. The available Entry method overloads are below and can be seen in the help guide.

            EnterLong()
            EnterLong(string signalName)
            EnterLong(int quantity)
            EnterLong(int quantity, string signalName)
            ​EnterLong(int barsInProgressIndex, int quantity, string signalName)


            EnterLong(): https://ninjatrader.com/support/help.../enterlong.htm

            You must modify the logic of your strategy to use either Exit methods or Set methods depending on your needs. You cannot use Exit methods and Set methods in the same script as this violates a managed approach internal order handling rule.

            Something you could also consider is using Atm Strategy Methods to submit an entry order with an Atm Strategy template attached to control the profit target and stop loss. This is only possible to do in an unlocked strategy. Atm Strategy Methods cannot be used with the Strategy Builder. You could see an example of using Atm Strategy Methods by opening a New > NinjaScript Editor window, opening the Strategies folder, and double-clicking on the SampleAtmStrategy file to view its code.

            And, see this help guide page for more information about Atm Strategy Methods: https://ninjatrader.com/support/help...gy_methods.htm

            Let me know if I may further assist.
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #7
              I wish NT would add that overload to Enter method, it would save a lot of work coding around the limitations. I also found Position.Close though the page URL escapes me at the moment. Can I use that with Set methods?

              Comment


                #8
                Hello Skechers,

                Thanks for your note.

                Position.Close is not a documented or supported method.

                See the available supported Position methods and properties on this help guide page: https://ninjatrader.com/support/help...htsub=position

                Ultimately, you would need to use either Exit methods OR Set methods when using the Managed Approach.

                You could consider using the Unmanaged Approach for order submission instead which offers ultimate flexibility in terms of order submission and management. Note that the Unmanaged approach is reserved for VERY EXPERIENCED programmers.

                See this help guide page about using the Unmanaged Approach: https://ninjatrader.com/support/help...d_approach.htm

                Let me know if I may assist further.
                <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                Comment


                  #9
                  Hi Brandon,

                  I was just going to post of going the unmanaged approach. I'm not finding the managed approach useful, especially when it causes valid orders to be ignored causing a loss.

                  I managed my own orders in TradeStation using order and orderticket objects. I don't really need this fangled "managed" order management thing.

                  So far NT 8 has been easy to work with except orders.

                  Many Thanks, Caesar.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Today, 05:17 AM
                  0 responses
                  50 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  126 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  69 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  42 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  46 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X