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

adding second Time Frame based on First

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

    adding second Time Frame based on First

    Would it be possible ( I suspect not) to add a secondary bar series based on the primary bar series?

    IE

    if the primary bar series is 100 tick then a 50 tick bar series would be added?

    so something like this:-

    Add(PeriodType.Tick, primaryBarPeriod/2)

    #2
    Hello GKonheiser,

    Thank you for your note.

    Yes, when you use the Add() method without a symbol string, it will use the primary instrument to create a new underlying data series.

    Your example will create an undelying data series that is half the primary.

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      thanks. If I then use,

      Add(PeriodType.Minute, BarsPeriod.BasePeriodValue/2);

      will I need to use Math.Round to catch problems with odd primary period values or will it round automatically?

      Comment


        #4
        GKonheiser,

        Correct, you will need to round the number for an INT as that is the overload property.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by GKonheiser View Post
          thanks. If I then use,

          Add(PeriodType.Minute, BarsPeriod.BasePeriodValue/2);

          will I need to use Math.Round to catch problems with odd primary period values or will it round automatically?
          No. BasePeriodValue is an int. If you divide an int by another int, the answer is always an int, created by truncation.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          26 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          192 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,234 views
          0 likes
          Last Post xiinteractive  
          Working...
          X