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

Multi threading - OnOrderUpdate

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

    Multi threading - OnOrderUpdate

    Hello,

    I am using Unmanaged order method,
    I ran my strategy with playback running recorded live data
    According to my log file it seems that two threads are enters concurrently to OnOrderUpdate .

    Is it possible?

    The Scenario is as follow :
    1. The strategy sent an enter order from OBU.
    2. after some Mili seconds a cancel enter order was sent.
    3. The OnOrderUpdate was called with order state partial filed (order. orderState I used the order read only input function )
    4. while handling this event in the context of OnOrderUpdate and before exit this function the OnOrderUpdate function was called again with order state CancelPending

    as I said I am using Unmanaged order method
    1. Is this behavior possible?
    2. Does it possible that the read only order input function var will change its order state in the middle of OnOrderUpdate execution and before this function end?

    Sincerely,Kobi






    #2
    Hello Kobi thanks for writing in.

    Strategies and Indicators run in their own thread, so this is not possible for a single strategy to execute its code on two threads at the same time. Everything that is happening during runtime is in a synchronous manner. It's not possible for OnOrderUpdate to get called while the script is in the middle of running OnOrderUpdate.

    I'm not sure what a read-only order input function var is. Could you give an example of this?

    I look forward to hearing from you.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello Chris L.

      Thank you for your response.

      1. I will check my strategy.
      2. Regarding
      I'm not sure what a read-only order input function var is. Could you give an example of this?
      I meant to
      protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string comment)
      I meant to
      An Order object passed by reference representing the order object
      Does the Order object that passed by reference can be change while the script is in the middle of running OnOrderUpdate.?

      Happy Thanksgiving,Kobi


      Comment


        #4
        Hello Kobi,

        The Order object passed in OnOrderUpdate would not change in the middle of the OnOrderUpdate iteration. We would get a new OnOrderUpdate iteration for the change/update.

        Let us know if you have any additional questions.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DavidHP, Today, 07:56 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by kujista, Today, 06:23 AM
        3 responses
        6 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by Mindset, Yesterday, 02:04 AM
        2 responses
        17 views
        0 likes
        Last Post NinjaTrader_RyanS  
        Started by f.saeidi, Today, 08:03 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by samish18, 04-17-2024, 08:57 AM
        15 responses
        52 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X