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 traderqz, Today, 12:06 AM
    5 responses
    8 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Mongo, Today, 11:05 AM
    2 responses
    7 views
    0 likes
    Last Post Mongo
    by Mongo
     
    Started by guillembm, Today, 11:25 AM
    0 responses
    3 views
    0 likes
    Last Post guillembm  
    Started by Tim-c, Today, 10:58 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by traderqz, Yesterday, 09:06 AM
    4 responses
    29 views
    0 likes
    Last Post traderqz  
    Working...
    X