• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Execution order

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

    Execution order

    Hello,

    would it be possible to force OnOrderUpdate() to be executed always before OnMarketData() and OnBarUpdate()?

    #2
    Hello guillembm,

    Thank you for your post.

    There is no means to force OnOrderUpdate() to be called before OnMarketData() and OnBarUpdate(). There is no means to force any set of functions to be called in a specific order. Please adhere to the Help Guide on when these functions are called.

    Any particular reason you wish to call the functions in this order?

    I look forward to your response.
    Patrick H.NinjaTrader Customer Service

    Comment


      #3
      I am having rejections when using the ChangeOrder() method. This is because, sometimes, this method is executed and the order has been already filled but the state hasn't been updated.

      to prevent it I set these filters before executing ChangeOrder():

      if (MyOrder.OrderState != OrderState.Filled
      && MyOrder.OrderState != OrderState.Cancelled
      && MyOrder.OrderState != OrderState.CancelPending
      && MyOrder.OrderState != OrderState.Unknown
      && MyOrder.OrderState != OrderState.ChangePending
      && MyOrder.OrderState != OrderState.Rejected )

      but it seems this is not enough. Forcing OnOrderUpdate() to be called first would be a good solution.

      Comment


        #4
        Hello guillembm,

        Thank you for your response.

        So you are calling ChangeOrder() in OnMarketData() and/or OnBarUpdate() but you are calling it when the order state is likely filled, cancelled, or rejected.

        Please try updating the an Order object in OnOrderUpdate and then checking that object in the function you call ChangeOrder() in.

        Please let me know if you have any questions.
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          Thanks.

          It seems I misunderstood it till now. I always believed that the order state was updated by NT and then this update triggered the execution of OnOrderUpdate() .

          When you say "Please try updating the an Order object in OnOrderUpdate and then checking that object in the function you call ChangeOrder() in." it seems like I can force in the order state to be updated. Can you provide sample code?

          Comment


            #6
            Hello guillembm,

            Thank you for your response.

            I mean that you create a custom Order object that you update in OnOrderUpdate() and then call that Order object in any other function.

            An example of this is available in the Order object documentation in the Help Guide at the following link: https://ninjatrader.com/support/help...n-us/order.htm

            Please let me know if you have any questions.
            Patrick H.NinjaTrader Customer Service

            Comment


              #7
              I am closer to the solution now. Following your advice I reduced almost all the rejections. There are still some but they became just an annoying message that doesn't affect the good behaviour of the system.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by kevinenergy, Today, 11:53 AM
              0 responses
              1 view
              0 likes
              Last Post kevinenergy  
              Started by verge, Today, 11:36 AM
              0 responses
              3 views
              0 likes
              Last Post verge
              by verge
               
              Started by Alfred, Today, 11:25 AM
              0 responses
              7 views
              0 likes
              Last Post Alfred
              by Alfred
               
              Started by tradr, Today, 10:51 AM
              3 responses
              8 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by slocumtrader, 02-08-2013, 10:51 AM
              5 responses
              1,836 views
              0 likes
              Last Post NinjaTrader_PatrickG  
              Working...
              X