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 CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            27 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            20 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            183 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            335 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            260 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X