Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

What is the relationship between ChangeOrder() and OnOrderUpdate() ?

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

    What is the relationship between ChangeOrder() and OnOrderUpdate() ?

    Hello.

    Does ChangeOrder() always triggers OnOrderUpdate() ?
    Or does it triggers only if something really changed in orders parameters?
    Or it depends of something else?

    I am using a flag variable Is_Change_Submitted that set to TRUE when order changes submitted.
    And I am going to set flag to FALSE in OnOrderUpdate(), but it is not triggered and the flag remains TRUE forever.

    So, what it correct way to handle orders changes?
    Do I need Is_Change_Submitted flag at all?
    Are there any scenarios where it can be useful?
    For example, can I change again or cancel order while it already submitted to change?
    Or what if strategy submit price change and, before order state changed to ChangeSubmitted, strategy will submit quantity change?

    Or I shouldn't care about it in Umnanaged approach?

    Thank you.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello fx.practic,

    Calling ChangeOrder() will cause OnOrderUpdate() to trigger, even if the values are the same for the working order.

    I would recommend not calling ChangeOrder() if the values are the same, and only call this when you are wanting to change the order price or quantity.

    Below is a link to an unmanaged script that calls ChangeOrder().
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you.
      Will search for bug on my side now.

      Ok. Here is once more question:
      if I am sending CL order with price like 100.248524850896.
      What will be the price of working order? Will it be like original (100.248524850896) or it will be rounded to tick size (100.25)?
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Hello fx.practic,

        The order may be ignored or rejected.

        I think the order price must be conformed to a tick size.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          It never was rejected or ignored because of this reason in my practice.
          So, the best approach is to RoundToTIckSize before to send and before to change order.
          Thank you.
          fx.practic
          NinjaTrader Ecosystem Vendor - fx.practic

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by samish18, Yesterday, 08:31 AM
          4 responses
          14 views
          0 likes
          Last Post elirion
          by elirion
           
          Started by funk10101, Yesterday, 09:43 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by TheWhiteDragon, 01-21-2019, 12:44 PM
          5 responses
          551 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by rtwave, 04-12-2024, 09:30 AM
          5 responses
          37 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by funk10101, Today, 12:02 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Working...
          X