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

Want to test Chart Bar Type... How?

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

    Want to test Chart Bar Type... How?

    I have an indicator that adds 2 additional bar periods as follows...

    Add(PeriodType.Range, 12);
    Add(PeriodType.Range, 24);

    I now want to adapt this for a tick chart. How do I test to see what the PeriodType is?

    (couldn't find anything in the help)

    Thanks,
    Saroj

    #2
    Hi saroj,

    You can add tick series using Add(PeriodType.Tick, 1000);

    You can identify the interval type of a chart using BarsPeriod.Id, but this property should not be accessed in Initialize, where you need to add series.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      thanks ryanM... yes I saw that but don't see how to construct the test...

      so if I have to Add the bars in the initialize section, but not allowed to test for what's on the chart there... how do I construct the "Add" statement so that it only adds tick bars to a tick chart and minute to a minute, etc.?

      Comment


        #4
        Right - the primary series is not available at the time the script needs to add. We only support hard coding additional series.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          can I use an enum definition for the user to select a bar type and then do a conditional on the "Add" statements or is that not available in the Initialize section?

          Comment


            #6
            We support only hard coding any additional series, but some users reports success with inputs and an enum may work as well. You're free to try but will be on your own to verify everything works as you expect and resolve any potential issues.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Ryan, if I want to try this what is the correct way to test the BarsPeriod.Id value?

              I doubt the following is correct, but just to show you what I'm trying to do.

              if (BarsPeriod.Id == "Range") Add(PeriodType.Range, addBarPeriod1);

              Comment


                #8
                saroj,

                Unfortunately we would not be able to offer any advice on this. However we will leave this thread open for other users to comment.
                MatthewNinjaTrader Product Management

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by kevinenergy, 02-17-2023, 12:42 PM
                117 responses
                2,765 views
                1 like
                Last Post jculp
                by jculp
                 
                Started by Mongo, Today, 11:05 AM
                5 responses
                15 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by SightCareAubetter, Today, 12:55 PM
                0 responses
                3 views
                0 likes
                Last Post SightCareAubetter  
                Started by traderqz, Today, 12:06 AM
                8 responses
                16 views
                0 likes
                Last Post traderqz  
                Started by SightCareAubetter, Today, 12:50 PM
                0 responses
                2 views
                0 likes
                Last Post SightCareAubetter  
                Working...
                X