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

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

    Multi threading

    Hi,

    I have a structure which is a member of my indicator.
    In OnBarUpdate() I Initialize and update this data structure.

    my question is if I run in the same time to different strategies on the same charts data that
    uses the same indicator do I need to use mutex(critical section) to protected the class memers? or it is a thread safe?

    thanks, Kobi

    #2
    Each strategy that is run is going to use it's own instances of the indicator so you do not need to worry about two scripts making calls to the same indicator. All your NinjaScript Strategies and Indicators will run on the same thread in the current version of NinjaTrader.

    Example: Strategy A and B both call indicator Z

    indicator Z has a couple parameter inputs. Regardless of whether or not A and B pass the same inputs there will be two different series stored within strategy A and B. A and B will each have access to Z's values which may or may not be the same depending on the values passed to it.

    Let me know if I can further assist.
    LanceNinjaTrader Customer Service

    Comment


      #3
      OK, but if they run in the same thread context it means that one of the strategy will be delayed.
      Is it possible that if I start a strategy then then each strategy will run in different thread?

      Comment


        #4
        There is not currently a supported way to run your strategies on a different thread. This is something we are looking to improve in the next major release of NinjaTrader. That being said, delay seen from running multiple strategies at a time is not something that should cause an issue on a modern CPU assuming strategy logic is reasonable.

        Let me know if I can further assist.
        LanceNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Christopher_R, Today, 12:29 AM
        0 responses
        9 views
        0 likes
        Last Post Christopher_R  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        166 responses
        2,235 views
        0 likes
        Last Post sidlercom80  
        Started by thread, Yesterday, 11:58 PM
        0 responses
        3 views
        0 likes
        Last Post thread
        by thread
         
        Started by jclose, Yesterday, 09:37 PM
        0 responses
        8 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,415 views
        0 likes
        Last Post Traderontheroad  
        Working...
        X