Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Order rejected

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

    #61
    Hello OldHatNoobCoder,

    Set the 'Parameter type' to Price, set the price to 99999
    Chelsea B.NinjaTrader Customer Service

    Comment


      #62
      Thanks.
      Click image for larger version  Name:	image.png Views:	0 Size:	14.3 KB ID:	1251277​​

      Comment


        #63
        Hello OldHatNoobCoder,

        This is showing the limit was rejected due to the OCOID. To confirm you are not submitted the replacement order through the account correct?

        If so, this is showing that even without submitting the order through the account the same error is occurring, and further shows with live orders your broker isn't rejecting orders that re-use OCOIDs from rejected/cancelled/filled orders and has different behavior than the Sim101 (or how NinjaTrader Brokerage works).
        Chelsea B.NinjaTrader Customer Service

        Comment


          #64
          Yep. Correct.

          Comment


            #65
            I changed the ordering of GetAtmStrategyStopTargetOrderStatus() and I was able to produce this error:
            Click image for larger version

Name:	image.png
Views:	103
Size:	19.1 KB
ID:	1251292

            Comment


              #66
              Hello OldHatNoobCoder,

              This occur typically occurs if this method is called before the entry order as filled and the Atm has become active. The warning in orange can be ignored if you are intentionally checking the stop and target status before the entry has filled and the Atm is active.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #67
                Hmm. When I place it later, nothing at all happens.
                Code:
                // If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements
                            if (status.GetLength(0) > 0)
                                {
                                    Print("The entry order average fill price is: " + status[0]);
                                    Print("The entry order filled amount is: " + status[1]);
                                    Print("The entry order order state is: " + status[2]);
                            // If the order state is terminal, reset the order id value
                            if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
                                orderId = string.Empty;
                                }
                            }
                        // If the stop order has been rejected, submit a new sell order
                            if (atmStrategyId.Length > 0)
                            {
                                bool stopOrderRejected = false;
                                string[,] stopOrders = GetAtmStrategyStopTargetOrderStatus("STOP1", atmStrategyId);
                
                                if (stopOrders.Length > 0)
                                {
                                    for (int i = 0; i < stopOrders.GetLength(0); i++)
                                       {
                                    if (stopOrders[i, 2].ToString() == "Rejected")
                                    {
                                        stopOrderRejected = true;
                                        Print ("Stop order rejected mofo ");
                                        break;
                                    }
                                }
                            }
                
                            if (stopOrderRejected)
                            {
                                double limitPrice = Close[0] - 10 * TickSize;
                                Order newLimitOrder = myAccount.CreateOrder(myInstrument, OrderAction.Sell, OrderType.Limit, OrderEntry.Automated, TimeInForce.Day, 1, limitPrice, 0, string.Empty, "NewLimitOrder", Core.Globals.MaxDate, null);
                                Account.Submit(new[] { newLimitOrder });
                            }    
                            // If the strategy has terminated reset the strategy id
                            else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
                                atmStrategyId = string.Empty;​

                Comment


                  #68
                  This occur typically occurs if this method is called before the entry order as filled and the Atm has become active. The warning in orange can be ignored if you are intentionally checking the stop and target status before the entry has filled and the Atm is active.
                  Also, the rejection messages were from the ATM strategy, and in that instance I was calling it before
                  Code:
                  // If the order state is terminal, reset the order id value
                  So as far as I know, this doesn't sound like it applies?

                  Comment


                    #69
                    Hello OldHatNoobCoder,

                    By 'place it later' do you mean you are calling the method later in time, or do you mean you are calling the method lower in the code? (An a new bar update would be later in time. lower in the code would be at the same time)

                    Before calling this are you checking that the GetAtmStrategyEntryOrderStatus() is returning as Filled?
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #70
                      By 'place it later' do you mean you are calling the method later in time, or do you mean you are calling the method lower in the code?
                      I meant lower in the code.

                      Yes, just didn't paste that:
                      Code:
                       string[] status = GetAtmStrategyEntryOrderStatus(orderId);
                              // If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements​[QUOTE][/QUOTE]

                      Comment


                        #71
                        Hello OldHatNoobCoder,

                        The logic should be requiring the status of the entry to be filled to check the stop and target status.
                        Chelsea B.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by LiamTwine, Today, 08:10 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post LiamTwine  
                        Started by Balage0922, Today, 07:38 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post Balage0922  
                        Started by JoMoon2024, Today, 06:56 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post JoMoon2024  
                        Started by Haiasi, 04-25-2024, 06:53 PM
                        2 responses
                        19 views
                        0 likes
                        Last Post Massinisa  
                        Started by Creamers, Today, 05:32 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post Creamers  
                        Working...
                        X