Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Help Guide says Don't do it

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

    Help Guide says Don't do it

    I would like to Add() two DataSeries to an indicator/Strategy. But I want to do it as a multiple
    of the compression of the Primary Data series. Example if the primary was 1 min I want the code to add in multiples of 7 times that or a 7 min and 49 min. The issue I see is that in Initialize where the add()'s would be, according to the help guide you are not supposed to access BarsPeriods[0].Value. which is the only way I see to get the primary data value the chart was created with.

    Does anyone know how this might be accomplished?
    Thanks

    Jerry

    #2
    Hello JerryWar,

    Thanks for your post.

    That is correct. It is not supported to add data series like this on the fly. I'm am not aware of a work around.

    You can do this and it may work, but please note that it is not supported to do so.

    Also, you would want to use BarsPeriod and not BarsPeriods[0].

    For example:

    Add(BarsPeriod.Id, BarsPeriod.Value*7);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ChelseaB
      Thanks especially for the suggestion. Its easy enough to give it a try. My only hesitation was that it might actually work but cause seemingly unrelated issues later on.

      Jerry

      Comment


        #4
        Jerry,

        Really its not supported because its really easy to get in to trouble when doing things with this.

        What you are asking for is fairly straight forward and should work fine and continue to work fine as long as you are only doing this.

        Using multiple data series and trying to use BarsPeriods[1] or doing incrementing or trying to use an if statement to decide how many data series to use can cause NinjaTrader to out right crash.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea,
          It does appear to work great. It makes my life much simpler. I will stay away from the conditional statements. I can see where I might have tried it.

          Thanks
          Jerry

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,602 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          8 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          4 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          12 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X