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

Thread-safe programming

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

    Thread-safe programming

    Hi,

    Josh mentioned on another thread (perhaps off-handedly?) that NT is multi-threaded, and we have to be careful to handle that ourselves. I'm now doing a version of my code that's going to contain 60-200 timeframe/instrument combinations within the same strategy (that is, 59-199 Add() calls)... and I'm curious about multi-threading.

    I'll put a lock() around OnBarUpdate()... what about other code, like OnExecution() or OnOrderUpdate()? Are those functions thread-safe, or do I also need to synchronize?

    And if I synchronize, any chance of dead-lock? Are any of the Enter/Exit position calls, for example, going to block because they're dependent on a thread which now might be stuck waiting for OnOrderUpdate() to finish?

    #2
    Unfortunately this is beyond the level of support we could provide. You would need to try on your own.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by maybeimnotrader, Today, 05:46 PM
    0 responses
    6 views
    0 likes
    Last Post maybeimnotrader  
    Started by quantismo, Today, 05:13 PM
    0 responses
    6 views
    0 likes
    Last Post quantismo  
    Started by AttiM, 02-14-2024, 05:20 PM
    8 responses
    166 views
    0 likes
    Last Post jeronymite  
    Started by cre8able, Today, 04:22 PM
    0 responses
    8 views
    0 likes
    Last Post cre8able  
    Started by RichStudent, Today, 04:21 PM
    0 responses
    5 views
    0 likes
    Last Post RichStudent  
    Working...
    X