Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

lock object is never used. Why?

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

    lock object is never used. Why?

    Thank you Chelsea. It works perfectly.

    I noticed that on the documentation

    https://ninjatrader.com/support/helpguides/nt8/NT%20HelpGuide%20English.html?positions_account.ht m
    any access to account / positions is thread safe

    but the examples in ProfitChaseStopTrailExamples_NT8.zip (ProfitChaseStopTrailAddonExample.cs and ProfitChaseStopTrailIndicatorExample.cs) the lock object is never used. Why?

    Best
    Gio
    Last edited by giogio1; 12-10-2024, 11:27 PM.

    #2
    Hello Gio,

    I've moved this post to a new thread as this was not on the subject of the thread you posted to. (Discussing the API)

    These examples do not loop over the Account.Orders or Account.Positions collections and there is no need to lock anything.​
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      That's great. Thank you. I am left curious of what is different in the Documentation's example that the lock is required?

      Comment


        #4
        Hello giogio1,

        A lock is required to make sure you get a hold on the collection while you are doing something like iterating through a loop of items.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        52 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        70 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        48 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X