Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting AccountSelector selected value

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

    Setting AccountSelector selected value

    I use the AccountSelector on a custom indicator. And I store the selected account in an indicator property set to type account. I want to use this property so that when the chart is refreshed, the selected account defaults back to what it was before the refresh.

    I have tried all of these methods below:

    accountSelector.SelectedAccount
    accountSelector.SelectedIndex
    accountSelector.SelectedItem
    accountSelector.SelectedValue
    accountSelector.DesiredAccount

    But nothing seems to work. The AccountSelector keeps defaulting to Sim101. How can I set the desired account in the AccountSelector?

    Thanks!


    #2
    Hello martyn73,

    Thank you for the question.

    This should be the DesiredAccount property if you are trying to set this value during the creation of the selector. Here is an example from the addon basic sample in the help guide, I have added changing to another sim account:

    Code:
    accountSelector = LogicalTreeHelper.FindLogicalNode(pageContent, "accountSelector") as AccountSelector;                    
    accountSelector.DesiredAccount = "SimAccount1";
    If you are trying to set the value later or in an event handler of some kind, that may be the problem. Are you setting this value right after creating the account selector?


    I look forward to being of further assistance.

    Comment


      #3
      Perfect, that works. I was trying to set it later which was the problem. Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      156 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      90 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      140 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      130 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X