• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling custom BarTypes inside Indicator

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

    Calling custom BarTypes inside Indicator

    Hello there,

    I recently moved from NT7 to NT8 and had a custom BarType created for me.

    It is called (BarsPeriodType) 584

    When I call

    if (BarsPeriod.BaseBarsPeriodType == (BarsPeriodType) 584)

    nothing happens.

    Do I need to use the AddDataSeries() function beforehand? What would be the period and where do I put it?

    Thank you.

    #2
    Hello ij001,

    You may want to try:

    if ((int)BarsPeriod.BaseBarsPeriodType == 584)


    If you are wanting to add the bar type as a secondary series to the script, yes, AddDataSeries() would be used.

    The help guide has a note about this:
    "2. You can add a custom BarsType which is installed on your system by casting the registered enum value for that BarsPeriodType. For example: AddDataSeries((BarsPeriodType)14, 10);

    3. You can specify optional BarsPeriod values (such as Value2) of a custom BarsType in the BarsPeriod object initializer. For example: AddDataSeries(new BarsPeriod() { BarsPeriodType = (BarsPeriodType)14, Value = 10, Value2 = 20 });"
    https://ninjatrader.com/support/help...dataseries.htm


    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello ij001,

      You may want to try:

      if ((int)BarsPeriod.BaseBarsPeriodType == 584)


      If you are wanting to add the bar type as a secondary series to the script, yes, AddDataSeries() would be used.

      The help guide has a note about this:
      "2. You can add a custom BarsType which is installed on your system by casting the registered enum value for that BarsPeriodType. For example: AddDataSeries((BarsPeriodType)14, 10);

      3. You can specify optional BarsPeriod values (such as Value2) of a custom BarsType in the BarsPeriod object initializer. For example: AddDataSeries(new BarsPeriod() { BarsPeriodType = (BarsPeriodType)14, Value = 10, Value2 = 20 });"
      https://ninjatrader.com/support/help...dataseries.htm

      Thank you for your quick reply.

      I tried

      if ((int)BarsPeriod.BaseBarsPeriodType == 584)

      but still nothing.

      I do not believe I need to add this dataseries. What I am trying to achieve is when I toggle between charts the indicator identifies which chart I am on and runs the appropriate code.

      For example, a range chart then I toggle to this custom bar chart.

      Any further thoughts?

      Comment


        #4
        Hello ij001,

        If you print:

        Print((int)BarsPeriod.BaseBarsPeriodType);

        What prints to the output window?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello ij001,

          If you print:

          Print((int)BarsPeriod.BaseBarsPeriodType);

          What prints to the output window?
          4

          So I updated if ((int)BarsPeriod.BaseBarsPeriodType == 4)

          and it works now.

          Thank you!

          Comment


            #6
            Hello ij001,

            This would indicate that the primary series is not your custom bar type.

            A value of 4 would be a Minute chart.

            Are you certain your custom bar type is selected on the chart?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello ij001,

              This would indicate that the primary series is not your custom bar type.

              A value of 4 would be a Minute chart.

              Are you certain your custom bar type is selected on the chart?
              The custom bartype is a mirror of the Range Bar. So visually it has always shown up a mirror image.

              Now when I call the indicator with a value of 4, it plots on the Mirror Range Bar.

              I can email you the bartype if you are able to confirm?

              Comment


                #8
                Hello ij001,

                BarsPeriodType Ids 1-12 are reserved by NinjaTrader for the bar types included with NinjaTrader.

                You can use the BarsType Identifier to print out the names of the BarsTypes.
                https://ninjatraderecosystem.com/use...pe-identifier/


                The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Aporshnev, Today, 01:47 AM
                0 responses
                6 views
                0 likes
                Last Post Aporshnev  
                Started by caveat_lector, Today, 12:12 AM
                1 response
                6 views
                0 likes
                Last Post Atm Card  
                Started by ksarin, Yesterday, 04:31 PM
                2 responses
                9 views
                0 likes
                Last Post Atm Card  
                Started by pharofx, Yesterday, 09:30 PM
                1 response
                19 views
                0 likes
                Last Post Atm Card  
                Started by swcooke, Yesterday, 08:39 PM
                1 response
                9 views
                0 likes
                Last Post Atm Card  
                Working...
                X