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 lightsun47, Today, 03:51 PM
        0 responses
        2 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        8 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        41 views
        0 likes
        Last Post futtrader  
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        13 views
        0 likes
        Last Post bltdavid  
        Started by port119, Today, 02:43 PM
        0 responses
        8 views
        0 likes
        Last Post port119
        by port119
         
        Working...
        X