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 mgco4you, Today, 09:46 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by wzgy0920, Today, 09:53 PM
              0 responses
              3 views
              0 likes
              Last Post wzgy0920  
              Started by Rapine Heihei, Today, 08:19 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by Rapine Heihei, Today, 08:25 PM
              0 responses
              6 views
              0 likes
              Last Post Rapine Heihei  
              Started by f.saeidi, Today, 08:01 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X