Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Specify account in code

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

    Specify account in code

    Is there a way to specify which account a strategy trades off of in the code?

    Also if you choose to set DataSeriesConfigurable = false; is there a way to set the default data series?

    Thanks
    Adam.

    #2
    Hi Adam, unfortunately not directly, but you can look into using Account.Name for example in OnBarUpdate() to ensure the strategy is run on a specific account only.

    Setting the series and type to use would not be offically supported at this time, but you can try setting those in Initialize() : example shows a 5 min chart used...

    BarsPeriod.Id = PeriodType.Minute;
    BarsPeriod.Value = 5;

    Comment


      #3
      How do I use the Account.Name

      Originally posted by NinjaTrader_Bertrand View Post
      Hi Adam, unfortunately not directly, but you can look into using Account.Name for example in OnBarUpdate() to ensure the strategy is run on a specific account only.

      Setting the series and type to use would not be offically supported at this time, but you can try setting those in Initialize() : example shows a 5 min chart used...

      BarsPeriod.Id = PeriodType.Minute;
      BarsPeriod.Value = 5;
      First off thank you Bertrand, this is very helpful.
      Then with the "Account.Name" is it possible in the OnBarUpdate() to so something like if Account.Name != Sim101
      Return
      ?

      And if it is possible, could you be so kind as to show how that would be coded?
      Again, thank you very much.

      Adam.

      Comment


        #4
        You have it correct - it would be:


        Code:
        				if(Account.Name != "Sim101")
        					return;
        This will prevent the strategy from running on any account that is not named Sim101.
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        661 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        375 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X