Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

An Set() medthod to submit an exit order has been ignored

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

    An Set() medthod to submit an exit order has been ignored

    I have reproduced an issue I am having with my strategy. It places multiple entry orders and sets a profit target for each entry. When there is more than one entry/target, I always get this message in the Output window:

    Strategy 'MyCrossover/79360561': An Set() method to submit an exit order at '7/7/2016 1:00:00 PM' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.

    I have reproduced it with the SampleMACrossOver strategy code. I attached the code to this post. I ran it on Market Replay on the CL 08-16 contract, 60 minute candles, for 7/7/16 and it created the above error. If you comment out one of the two SetProfitTarget and EnterLongStopMarket, then it works without crashing.

    Is this a bug?

    Thanks!
    Bryan
    Attached Files
    cassb
    NinjaTrader Ecosystem Vendor - Logical Forex

    #2
    Hello Bryan,

    Thanks for your post.

    We will investigate and update you with our findings.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul. Let me know, because we are holding up development until this can be fixed.

      Bryan
      cassb
      NinjaTrader Ecosystem Vendor - Logical Forex

      Comment


        #4
        Hello cassb,

        Thank you for your patience.

        The orders will be ignored when the opposite entry order is still active from the other crossover. This is expected. To resolve you would need to ensure the order from the opposite crossover condition is not active in the market.

        You can use OnOrderUpdate() to check the status of orders when the order is changed. You can use Order objects to track the state of orders as well.

        Comment


          #5
          I'm sorry but I don't follow. Can you please explain in a bit more detail what you mean by "the opposite entry order is still active from the other crossover."?

          And maybe if you could edit and attach the strategy code that I sent so that it does what I'm trying to do? I want to have multiple entries from the same entry price, but each entry having a different profit target price.

          Thanks!
          Bryan
          cassb
          NinjaTrader Ecosystem Vendor - Logical Forex

          Comment


            #6
            Hello cassb,

            Thank you for your response.

            If an order is active to go long and it has not filled yet and then another condition returns true and submits an order to go short, that order to go short will be ignored.

            Cross over refers to the CrossAbove() and CrossBelow() conditions in your script. We would not provide edits to code for users but we can provide examples. However, you would need to understand and implement the logic into your strategy.

            A basic example would be the following:
            Code:
            if (myLongOrder == null && myShortCondition)
            // Enter short
            if (myShortOrder == null && myLongCondition)
            // Enter long
            For information on OnOrderUpdate and Order please visit the following links:

            Comment


              #7
              Are you saying that you think the problem is that before the second long Profit Target is hit, a short entry order is placed and rejected?
              cassb
              NinjaTrader Ecosystem Vendor - Logical Forex

              Comment


                #8
                Originally posted by cassb View Post
                Are you saying that you think the problem is that before the second long Profit Target is hit, a short entry order is placed and rejected?
                No, I would be referring to the first Cross Over condition placing entry orders to go long they are not filled and the short entry orders are submitted.

                In the SetDefatuls State of your strategy enable TraceOrders. Then open the Output window under New > NinjaScript Output on the Control Center. Test your strategy and you can see the orders and when they occur in the Output window.

                For information on TraceOrders please visit the following link: http://ninjatrader.com/support/helpG...raceorders.htm

                Comment


                  #9
                  I'm sorry, but that's not what is happening. The error message clearly is referring to one of the profit target or the stoploss orders on the entry, not another entry order. This code I attached creates the same error (you may have to run it a few times) with only short orders being placed.

                  Bryan
                  Attached Files
                  cassb
                  NinjaTrader Ecosystem Vendor - Logical Forex

                  Comment


                    #10
                    Hello cassb,

                    Thank you for your response.

                    It is the same scenario but a different message. 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 an exit method (ExitLongLimit() for example) is active


                    Your Enter orders are still active when you try to submit the new Enter and Set methods.

                    Comment


                      #11
                      OK I am totally confused then. Can you please tell me how I would use SetProfitTarget to create multiple exit prices for a single entry position? Is there an example strategy I can look at?

                      By the way, I am using the code I provided in NT7 and it works great. I believe something is broken in NT8.
                      Last edited by cassb; 07-14-2016, 07:13 AM.
                      cassb
                      NinjaTrader Ecosystem Vendor - Logical Forex

                      Comment


                        #12
                        Hello cassb,

                        Thank you for your response.

                        Your multiple exits for entry in one direction is not the problem. It is the orders till being active when the opposite orders are submitted.

                        Here is a basic example for multiple exits:
                        Code:
                        		protected override void OnStateChange()
                        		{
                        			if (State == State.SetDefaults)
                        			{
                        				...
                        			}
                        			else if (State == State.Configure)
                        			{
                        				SetProfitTarget("entry1", CalculationMode.Ticks, 5);
                        				SetProfitTarget("entry2", CalculationMode.Ticks, 5);
                        			}
                        		}
                        
                        		protected override void OnBarUpdate()
                        		{
                        			if (Close[0] > Open[0])
                        			{
                        				EnterLongStopMarket(Close[0] + 5 * TickSize, "entry1");
                        				EnterLongStopMarket(Close[0] + 5 * TickSize, "entry2");
                        			}
                        		}

                        Comment


                          #13
                          I don't understand which orders you are referring to that are still active when the opposite orders are submitted. The strategy was flat until the crossover happens, when the two sell stop orders are placed. There are no opposite orders other than the Stoploss and Profit Target orders.
                          cassb
                          NinjaTrader Ecosystem Vendor - Logical Forex

                          Comment


                            #14
                            Hello cassb,

                            Thank you for your time today.

                            I have recorded a video for you at the following link to explain the behavior further: http://screencast.com/t/TtkIcobqiwK

                            Comment


                              #15
                              OK, I see what you are saying now - thanks for the video, Patrick. But I understood that before, and gave you a second copy of the strategy code that has all of the logic that places long orders commented out, and the problem still happens. So it cannot be what you are explaining in the video. Check my message from 7/13 at 5:12pm. I had attached a new MyCrossover.zip file. Let me know if this still produces the error on your end... it does on mine.

                              Bryan
                              cassb
                              NinjaTrader Ecosystem Vendor - Logical Forex

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by FrazMann, Today, 11:21 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post FrazMann  
                              Started by geddyisodin, Yesterday, 05:20 AM
                              8 responses
                              52 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by cmtjoancolmenero, Yesterday, 03:58 PM
                              10 responses
                              36 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by DayTradingDEMON, Today, 09:28 AM
                              4 responses
                              24 views
                              0 likes
                              Last Post DayTradingDEMON  
                              Started by George21, Today, 10:07 AM
                              1 response
                              20 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Working...
                              X