Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Suggestion: Get account name, change account programmatically

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

    Suggestion: Get account name, change account programmatically

    It's already a great improvement to be able to access the CashValue of the account, etc. However, it would also be nice to be able to access the name of the account. (I for example would need this to verify that the account is set to Sim101 when running a strategy in a special mode.) It would be even nicer to be able to programmatically change the account a strategy uses. This would enable a strategy to put itself in and out of simulation mode (e.g. after a losing streak, etc.).

    #2
    Thanks for the suggestion and I will add this to our beta feedback list.
    RayNinjaTrader Customer Service

    Comment


      #3
      I just noticed that the name of the current account CAN be accessed programmatically (might not be supported though):

      Code:
      [FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][COLOR=black]Print(Account.Name);[/COLOR][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
      Now the questions is if there is any way to switch accounts programmatically too...

      Comment


        #4
        you can do this already using the

        Cbi.Accounts.FindByName() function.


        Best regards

        andreas

        www.zweisteintrading.eu

        ninjatinymobiletrader

        Comment


          #5
          Your approach is valid and as you noted outside of what is officially supported.

          I must however say:

          I highly advise NOT to set this property with a different account object as you will be guaranteed to have unexpected and possible damaging behaviour.
          RayNinjaTrader Customer Service

          Comment


            #6
            Ray,

            thanks for pointing out.

            For myself I am careful and I set the Account object only at the early stages of existance of a strategy object, for sure much earlier than OnBarUpdate.

            regards

            Comment

            Latest Posts

            Collapse

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