Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Account Selector

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

    Account Selector

    I have a workspace arrange with windows so small I cannot see the Account which is selected in the account selector. To combat this I wrote an indicator which displays the account name on the actually chart. I got the code from the forum search:

    Code:
                ChartControl.Dispatcher.InvokeAsync((Action)(() =>
                {
                    //You have to put the stuff below within this ChartControl.Dispatcher.InvokeAsync((Action)(() =>, because you are trying to access something on a different thread.
                    xAlselector = Window.GetWindow(ChartControl.Parent).FindFirst("ChartTraderControlAccountSelector") as NinjaTrader.Gui.Tools.AccountSelector;
                    //Print(xAlselector.SelectedAccount.ToString());
                    Draw.TextFixed(this, "Account Name", TopPadding_String + xAlselector.SelectedAccount.ToString() + BottomPadding_String, TextPosition, MyBrush, MyFont, Brushes.Transparent, MyBackground, MyBackgroundOpacity);            
                }));​
    The problem is, the text doesn't update if the account is changed. I have to reload the chart. is there way to detect the account has been changed and update the text`? Having the code inside onBarUpdate with onEachTick doesn't update the account fixed text.

    #2
    Hello lucyb,

    Add an event handler to the <AccountSelector>.SelectionChanged event.

    See the example with sample code below.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

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