• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding new bars object dynamically..

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

    Adding new bars object dynamically..

    Hi ninjas,

    I´d like to know how to add a variable numbers of new bars object if I need them in order to do certain statisticals, instead just to add them just a fix numbers at first of the code. I mean: let´s say that for certain month I´d like to evaluate 3 different bars object but for the next month I´d need 4 one.

    The normal way is setting them is like this:

    protected override void Initialize()
    {
    Add("$EURUSD", PeriodType.Tick, x); // adding #1
    Add("$EURUSD", PeriodType.Tick, x); // adding #2

    But I´d like to be able to add them dynamically for optimization, 2, 3...etc etc

    If not, is there any procedure or function in a library that I can use it?

    Thanks

    #2
    Hello pstrusi,
    Unfortunately you cannot use the Add() method to add additional bar series dynamically. The Add() method will add the additional bar series only when you initialize the strategy.

    Depending on what you are using you can use the below unsupported code to load a bar series on the fly.
    NinjaTrader.Data.Bars.GetBars(...)

    Please refer to this post which further discusses on it.
    http://www.ninjatrader.com/support/f...ad.php?t=44797
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Why not in a "for loop"

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Sparkyboy, Yesterday, 08:08 PM
      3 responses
      27 views
      0 likes
      Last Post eDanny
      by eDanny
       
      Started by ttodua, Yesterday, 02:51 AM
      2 responses
      10 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by PeterGolz, 01-17-2020, 10:42 AM
      8 responses
      45 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by GARZONJ, Today, 09:39 AM
      2 responses
      24 views
      0 likes
      Last Post Sparkyboy  
      Started by Obelixtrader, Yesterday, 08:16 AM
      3 responses
      18 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X