• 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 shaista parveen, Today, 01:45 AM
      0 responses
      1 view
      0 likes
      Last Post shaista parveen  
      Started by poritiblus, Today, 12:42 AM
      0 responses
      2 views
      0 likes
      Last Post poritiblus  
      Started by swcooke, Yesterday, 11:54 PM
      0 responses
      2 views
      0 likes
      Last Post swcooke
      by swcooke
       
      Started by kweiss, Yesterday, 08:35 PM
      0 responses
      3 views
      0 likes
      Last Post kweiss
      by kweiss
       
      Started by zulok, Yesterday, 05:02 PM
      0 responses
      7 views
      0 likes
      Last Post zulok
      by zulok
       
      Working...
      X