Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged orders error

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

    Unmanaged orders error

    Hi,

    I'm starting to work with unmanaged orders and I 'm getting my first errors.

    When submitting the order I get this error: "**NT** Error on calling 'OnOrderUpdate' method for strategy 'HFTSimple/5ec21fb573094c7d9525423c79ed8173': Object reference not set to an instance of an object."

    The submit order that gives the error is:

    MyExitOrder = SubmitOrder(0,OrderAction.BuyToCover,OrderType.Lim it,Position.Quantity,AskPrice,0,"AllOrders","");

    This Submit is done after cancelling a previous Limit order to take profits:

    CancelOrder(ProfitLimit);

    #2
    Hello,

    Thanks for the note.

    Make sure you are doing null reference checks before trying to access iOrder objects is most likely what you are missing.



    entryOrder != null

    I look forward to assisting you further.

    Comment


      #3
      Thanks,

      when I submit the order I Print the value and I know is null.

      if (MyExitOrder == null)
      {
      MyExitOrder = SubmitOrder(0,OrderAction.BuyToCover,OrderType.Lim it,Position.Quantity,AskPrice,0,"AllOrders","");
      }

      With TraceOrder = true I get this error:
      9/13/2011 4:15:00 PM Entered internal SubmitOrder() method at 9/13/2011 4:15:00 PM: Action=Sell OrderType=Limit Quantity=100 LimitPrice=46.84 StopPrice=0 OcoId='AllOrders' Name=''
      **NT** Error on calling 'OnOrderUpdate' method for strategy 'HFTSimple/5ec21fb573094c7d9525423c79ed8173': Object reference not set to an instance of an object.

      Comment


        #4
        Why the error appear in OnOrderUpdate()?

        Perhaps is a problem of the token?

        if (MyExitOrder != null && MyExitOrder.Token == execution.Order.Token)

        Comment


          #5
          Right yea this would be an issue.

          You can't have MyExitOrder be null and then also check it to see if it has a token value. The token value check would need to come inside of the null check.

          Let me know if I can be of further assistance.

          Comment


            #6
            You mean this?

            if (MyExitOrder != null)
            {
            if (MyExitOrder.Token == execution.Order.Token)
            {


            }
            }

            Comment


              #7
              Exactly,

              You would need to make sure you do this with every time you try to access information in an iOrder object.

              I look forward to assisting you further.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by martin70, 03-24-2023, 04:58 AM
              15 responses
              114 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by The_Sec, Today, 02:29 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by jeronymite, 04-12-2024, 04:26 PM
              2 responses
              31 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by Mindset, 05-06-2023, 09:03 PM
              10 responses
              265 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by michi08, 10-05-2018, 09:31 AM
              5 responses
              743 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X