• 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

Show Keltner Band Spread Calculations

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

    Show Keltner Band Spread Calculations

    How can I get an indicator that tells me the distance in points, between the upper Keltner band and the lower Keltner band?
    Keltner Channel indicator

    #2
    Hello Vizard,
    Thanks for your post and welcome to the NinjaTrader forum.

    Are you trying to program this indicator yourself or simply looking for a place to download this indicator?
    JoshNinjaTrader Customer Service

    Comment


      #3
      Thanks for answering
      I'm not a programmer, I'm just looking for a place to download this indicator if it exists with that modification and if not how I could modify it to obtain that additional information to the Keltner Channel.

      Comment


        #4
        Vizard,

        I am not aware of a specific indicator that does this. You may have some luck searching in the User App Share section.

        https://ninjatraderecosystem.com/user-app-share/

        I can help you modify the existing Keltner Channel indicator to provide that information fairly easily. How would this value be displayed on the chart?
        JoshNinjaTrader Customer Service

        Comment


          #5
          Thanks for the help.
          I have ended up asking in this section, because I have been searching for it for several days without success on the Internet, in the forum and User Application Section as well.
          I have a capture, as it is in the graphic, I attach it to you.
          It is a panel, like a box, located on the upper left of the graph, what it does is measure the width of the entire channel and shows you at each moment how large the points in the Keltner Channel is, where B.Sp. 10.68 in the image.
          This Keltner indicator in particular is called KeltnerChannelEMA to nijatrader 7
          Attached Files

          Comment


            #6
            Vizard,

            You can open and edit the built in Keltner Indicator by going to your Control Center>>Tools>>Edit NinjaScript>>Indicator...>>select "KeltnerChannel"

            You could add the difference value to the top left by simply adding something similar to the following at the bottom of OnBarUpdate() and the right-clicking to select "compile".

            Code:
            DrawTextFixed("tag", "Difference: "+diff[0], TextPosition.TopLeft);
            As far as the box surrounding it, that is a more advanced concept. I can tell you how to draw a rectangle, but it would be up to you to come up with the appropriate logic to get it drawn around the difference value. Let me know if you are interested in hearing more.
            JoshNinjaTrader Customer Service

            Comment


              #7
              Hello JoshG,
              It would be like this the modification ??, the box I do not care with that it appears the value of the channel in the left would serve to me, comfirmame that is well and I modify it in the indicator.
              Code:
                protected override void OnBarUpdate()
                      DrawTextFixed("tag", "Difference: "+diff[0], TextPosition.TopLeft);    
                      {
                          diff.Set(High[0] - Low[0]);
              
                          double middle    = EMA(Typical, Period)[0];
                          double offset    = EMA(diff, Period)[0] * offsetMultiplier;
              
                          double upper    = middle + offset;
                          double lower    = middle - offset;
              
                          Midline.Set(middle);
                          Upper.Set(upper);
                          Lower.Set(lower);
                      }

              Comment


                #8
                Vizard,

                It would go inside the OnBarUpdate() method. It would be something like this:

                Code:
                protected override void OnBarUpdate()
                {
                         diff.Set(High[0] - Low[0]);
                
                         double middle    = EMA(Typical, Period)[0];
                         double offset    = EMA(diff, Period)[0] * offsetMultiplier;
                
                         double upper    = middle + offset;
                         double lower    = middle - offset;
                
                         Midline.Set(middle);
                         Upper.Set(upper);
                         Lower.Set(lower);
                         DrawTextFixed("tag", "Difference: "+diff[0], TextPosition.TopLeft);    
                 }
                JoshNinjaTrader Customer Service

                Comment


                  #9
                  JoshG,
                  I have modified the indicator correctly, a value appears in the upper left, but it is not the correct value that should appear in points, when measuring the width of the channel by hand is greater, I attach capture.
                  Attached Files

                  Comment


                    #10
                    Vizard,

                    You would need to do your own math to get that value. I was able to use the following snippet to calculate that. I suggest putting this where you currently have the DrawTextFixed method

                    Code:
                    double BaseValue    = Bars.Instrument.MasterInstrument.PointValue*TickSize;
                    double numTicks     = diff[0]*TickSize;
                    double final        = numTicks*BaseValue;
                    
                    DrawTextFixed("tag", "Difference: "+final, TextPosition.TopLeft);
                    JoshNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Orden33, Today, 10:09 AM
                    2 responses
                    7 views
                    0 likes
                    Last Post Orden33
                    by Orden33
                     
                    Started by martyn73, Today, 10:18 AM
                    4 responses
                    11 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by silverm3170, Today, 10:03 AM
                    3 responses
                    3 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by diff24rac, 04-04-2018, 05:32 AM
                    6 responses
                    481 views
                    0 likes
                    Last Post fx.practic  
                    Started by gma17, Today, 08:58 AM
                    3 responses
                    11 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Working...
                    X