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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        66 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X