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 fwendolynlpxz, Today, 05:19 AM
    0 responses
    1 view
    0 likes
    Last Post fwendolynlpxz  
    Started by traderqz, Yesterday, 12:06 AM
    11 responses
    27 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by PaulMohn, Today, 03:49 AM
    0 responses
    8 views
    0 likes
    Last Post PaulMohn  
    Started by inanazsocial, Today, 01:15 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by rocketman7, Today, 02:12 AM
    0 responses
    11 views
    0 likes
    Last Post rocketman7  
    Working...
    X