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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        67 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        36 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        60 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X