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 DJ888, Today, 10:57 PM
          0 responses
          6 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Today, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Working...
          X