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 Skifree, Today, 03:41 AM
    1 response
    2 views
    0 likes
    Last Post Skifree
    by Skifree
     
    Started by usazencort, Today, 01:16 AM
    0 responses
    1 view
    0 likes
    Last Post usazencort  
    Started by kaywai, 09-01-2023, 08:44 PM
    5 responses
    603 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by xiinteractive, 04-09-2024, 08:08 AM
    6 responses
    23 views
    0 likes
    Last Post xiinteractive  
    Started by Pattontje, Yesterday, 02:10 PM
    2 responses
    23 views
    0 likes
    Last Post Pattontje  
    Working...
    X