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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    78 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X