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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X