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 andrewtrades, Today, 04:57 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    3 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    6 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X