• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AccountSelector does not update text when changed programmatically

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

    AccountSelector does not update text when changed programmatically

    I am instantiating an AccountSelector, and on the first callback to SelectionChanged (which is when the accounts are populated), I set the SelectedAccount to my desired value. The underlying selected value changes correctly, but the text in the underlying ComboBox still contains the prior account name.

    I have tried a lot of things but can not get that field to update with the new value.

    I also tried using the DesiredAccount property, but that did nothing.

    Could be a bug, but perhaps I am not doing something right? Any ideas?

    Also, in your AddOnFramework example (and the doc) the SelectionChanged logic has an issue because you unsubscribe from the new account instead of the previous account.

    #2
    Hello aslane,

    Thank you for your note.

    For the Combobox, what statement are you using to set the desired value? For example,

    Code:
    xComboBox.SelectedItem or xComboBox.Text.?
    Regarding the AddonFramework example, within private DependencyObject LoadXAML(), I add the following print statement under if(accountSelector.SelectedAccount != null),

    Code:
    NinjaTrader.Code.Output.Process(accountSelector.SelectedAccount.ToString(), PrintTo.OutputTab1);
    And see that you'd be subscribing to the new account after any old account subscriptions were unsubscribed. The note just above the unsubscribing statements in the script, // Unsubscribe to any prior account subscriptions, seems to accurately describe whats happening. When testing the behavior, the Addon appears to be correctly subscribed to the new account. Would you be able to provide steps which demonstrate your point?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      It is trivial to see in the code and to reproduce the unsubscribe issue.

      When SelectionChanged is called, the current SelectedAccount is unsubscribed which is wrong. It should be the previous account. The same account is then subscribed. So you basically never unsubscribed the previous account.

      If you have two sim accounts and run the example framework add on, you can watch execution updates, and then change the account to another account, and then in another window make some trades in the original account. You will see those executions even though you should be unsubscribed.

      Comment


        #4
        For setting the initial value of AccountSelector, use the DesiredAccount string in the constructor.

        Comment


          #5
          Hello aslane,

          In the video, I first change the account to Account1 from Sim101, which if I understand correctly you are saying would be unsubscribing to the new Account1 not Sim101, however when I then place a trade on the dom to the SIM101 and hit Account values, it does not show the position which indicates that the subscription to the SIM101 account was unsubscribed from.

          https://www.screencast.com/t/Ieu3AMFd

          Are you seeing something different?

          The Account Selector is going to be populated based on accounts available when connected, attempting to set this may be possible, however would be unsupported.

          I look forward to your reply.
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            I should not have to do this but here we go:

            1. Use two sim accounts (i.e. Sim101 and TempSim)
            2. Start the AddOnFramework, likely defaults to Sim101
            3. Click OnExecutionUpdate to monitor executions
            4. Switch account to TempSim in the AddOnFramework -> should be monitoring TempSim now
            5. Now in a chartWindow with ChartTrader turned on, and account Sim101 selected buy/sell
            6. At this point the AddOnFramework will show the buy/sell executions even though they are for the wrong account <- reason being the Sim101 account was never unsubscribed
            7. If you now go switch the ChartTrader to account TempSIm and buy/sell, the AddOnFramework again shows the executions <- this is because that account is also subscribed.

            The code can not work as is.

            Comment


              #7
              Hello aslane,

              I was able to replicate and will follow up when I have more information.

              Thank you for your report.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Hello aslane,

                I have reported this as a bug.

                Thank you for your report.
                Alan P.NinjaTrader Customer Service

                Comment


                  #9
                  Hello aslane,

                  I added temp account variable to hold the previous accounts value, so that upon a change its this account that is unsubscribed from rather than the new account.

                  I'll submit the revised AddonFramework for addition to the addon, but if you see any issue in the attached version, please let us know.

                  Thank you for bringing this to our attention.
                  Attached Files
                  Alan P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by jjnc2006, Today, 07:36 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post jjnc2006  
                  Started by futurenick, Today, 06:26 AM
                  1 response
                  11 views
                  0 likes
                  Last Post nkhoi
                  by nkhoi
                   
                  Started by NinjaCustomer, Today, 12:29 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_ShawnB  
                  Started by Steve L, Today, 11:32 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post Steve L
                  by Steve L
                   
                  Started by prabbala, Today, 10:41 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post prabbala  
                  Working...
                  X