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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    150 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    302 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    243 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    344 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    174 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X