Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IsSelected unexpected behavior

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

    IsSelected unexpected behavior

    I have an indicator that draws multiple rectangles.
    It has a function that handles mouse button events. ChartControl.MouseLeftButtonDown += MouseClicked;

    The function loops over rectangles an does some actions with the one that user selects.

    foreach (Zone D in DemandZones)
    {
    if (D.Z.IsSelected)
    {
    Log("clicked on " + D.Z.Tag , LogLevel.Information);
    }
    }​

    It works fine. However, if user selects a rectangle and UNLOCKS it, the rectangle remains Selected. Now this functions find two selected rectangles: the one that has been unlocked and a new one the user clicks after. Locking that first one back does not change anything, it remains Selected.​

    #2
    Hello LeonK,

    Thanks for your post.

    What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)​

    Please create and share a reduced simple test indicator that reproduces the behavior and the exact steps and settings used to reproduce the behavior so we may look into this further.

    Note that a reduced copy refers to a copy of the script that contains the minimum amount of code needed to reproduce the issue. All other code is commented out or removed.

    To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.​

    To export the simple test indicator, go to Tools > Export > NinjaScript AddOn.

    I look forward to assisting further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    636 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    568 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    571 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X