Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Choppiness Index

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

    Choppiness Index

    Greetings, I am seeking assistance in creating a modified version of the NT8 Choppiness Index indicator. Currently, I am using the Choppiness Index with a displacement of negative 5, which shifts the indicator back by 5 bars visually. However, due to this displacement, the last 5 bars on the right side do not display the Choppiness indicator (please refer to the attached picture).

    I would like to modify the Choppiness Index indicator so that the plot values are shifted directly instead of using the displacement property. By doing this, we can then apply mathematical calculations to set the plot values for the "predicted" (last 5 bars) based on calculated values. The "predicted" values will be derived from the Choppiness plot values, but we need to adjust them to match the last shifted/offset plot value. Thank you for your help in advance.
    Attached Files

    #2
    Hello pickles1774,

    Thanks for your post.

    Are you referring to using the Displacement property in OnStateChange() in an indicator script?

    In the Indicators OnStateChange method when State is State.SetDefaults add Displacement = 5; to render a plot 5 bars back in relation to the bars on the chart.

    Then remove the instance of the indicator and add a new instance of the indicator to the chart.

    See this publicly available help guide documentation for more information on Displacement: https://ninjatrader.com/support/help...ent.htm​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hello Brandon,
      I have little coding experience and would not know what that means. I final results I want to achieve is displacing/offset the indicator (-10 bars) to the left, and still plot the indicator for the last 10 current bars on the right side.

      Comment


        #4
        Hello pickles1774,

        Thanks for your notes.

        You could set the Displacement property in OnStateChange() method when State == State.SetDefaults to render a plot 5 or 10 bars back in relation to the bars on the chart.

        See the help guide page linked in post # 2 for more information about using the Displacement property.

        "I have little coding experience and would not know what that means."

        If you need someone to write this script for you and add this displacement on your behalf, you can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script.

        You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more!

        https://ninjatraderecosystem.com/sea...mming-services

        Educators - https://ninjatraderecosystem.com/sea...ures=education

        You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

        This 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 companies and services 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.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Will this still plot the indicator for the last 10 bars on the right side.

          Comment


            #6
            Hello pickles1774,

            Thanks for your notes.

            Yes, setting the Displacement property to 10 would cause the current indicator values to plot to the right of the current bar on the chart.

            See the attached screenshot demonstrating this.
            Attached Files
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #7
              I think there's a misunderstanding. I need the indicator to be displace/offset by negative 10; this will cause the indicator to be shifted to left by ten bars, and the indicator will not show on the last 10 bars. So addition to the above, I also need the indicator to continue to plot on the last 10 bars even though it is shifted to left.

              Comment


                #8
                Hello pickles1774,

                Thanks for your notes.

                If you set the Displacement property to -10, this means that the indicator value of the current bar on the chart will be placed 10 bars back.

                As you can see in the attached screenshot, the unmodified Choppiness Index indicator has a current plot value of 48.87.

                The plot value of the ChoppinessIndexModified script has a Displacement of -10 so the current bar indicator plot will display 10 bars back from the current bar. We can confirm this is still showing the indicator value of the current bar because it is also 48.87 (the same value as the default Choppiness Index indicator with 0 Displacement).

                There would be no methods or properties available to push the current bar's indicator value back 10 bars and still have it plotted on the current bar like the default Choppiness Index indicator is.
                Attached Files
                <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                Comment


                  #9
                  Brandon in this post https://forum.ninjatrader.com/forum/...remaining-bars, ​ I believe is a similar situation. Can this logic still be possible?

                  Comment


                    #10
                    Hello pickles1774,

                    Thanks for your note.

                    Yes, you could consider trying to implement the logic noted in that forum post into a custom indicator script to create an indicator that has plot values offset instead of using the displacement property.

                    For more information on plotting Choppiness Index in a custom indicator, please see the documentation below.

                    AddPlot() (creating plots and assigning plot values) - https://ninjatrader.com/support/help...8/?addplot.htm
                    Choppiness Index syntax: https://ninjatrader.com/support/help...ness_index.htm
                    Working with Price Series (Indexing/BarsAgo references) - https://ninjatrader.com/support/help...ice_series.htm

                    If you need someone to write this script for you and add this logic on your behalf, you can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script.

                    See post # 4 in this forum thread for more information about contacting a professional NinjaScript Consultant.​
                    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                    Comment


                      #11
                      Thanks Brandon for all your help

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      603 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      349 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      104 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      560 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      560 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X