Announcement

Collapse
No announcement yet.

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.

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        89 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        135 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X