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.

    http://www.ninjatrader.com/support/h...nt7/iorder.htm

    entryOrder != null

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    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.
          BrettNinjaTrader Product Management

          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.
              BrettNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by wjadevries, Yesterday, 04:18 PM
              17 responses
              59 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by chaitunt, Today, 10:33 AM
              0 responses
              1 view
              0 likes
              Last Post chaitunt  
              Started by UltraNIX, Today, 10:00 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by stewarco, Today, 10:14 AM
              0 responses
              4 views
              0 likes
              Last Post stewarco  
              Started by Newtrader101, Today, 06:36 AM
              1 response
              15 views
              0 likes
              Last Post NinjaTrader_Spencer  
              Working...
              X