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 PaulMohn, Today, 12:36 PM
              0 responses
              2 views
              0 likes
              Last Post PaulMohn  
              Started by love2code2trade, 04-17-2024, 01:45 PM
              4 responses
              38 views
              0 likes
              Last Post love2code2trade  
              Started by alifarahani, Today, 09:40 AM
              2 responses
              14 views
              0 likes
              Last Post alifarahani  
              Started by junkone, Today, 11:37 AM
              3 responses
              21 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by frankthearm, Yesterday, 09:08 AM
              12 responses
              44 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X