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 zstheorist, Today, 07:52 PM
          0 responses
          3 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          149 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          5 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          5 views
          0 likes
          Last Post tkaboris  
          Working...
          X