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