Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Keltner channel and bollinger midline not lining up

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

    Keltner channel and bollinger midline not lining up

    When running both keltner channel and bollinger bands in the same chart with the same Period parameter(20), the two midlines do not line up.

    I am assuming that the midlines should be the same calculation with the simple average.

    How can I fix this?

    #2
    Originally posted by acdrew0 View Post
    When running both keltner channel and bollinger bands in the same chart with the same Period parameter(20), the two midlines do not line up.

    I am assuming that the midlines should be the same calculation with the simple average.

    How can I fix this?
    Pull up your DataBox and cross-check if the actual values match. You may be seeing a drawing artifact.

    Comment


      #3
      Please check as koganam has suggested.

      If you can provide a screen shot, this should help us identify what you're seeing.
      MatthewNinjaTrader Product Management

      Comment


        #4
        Just checked. There are differences between the midlines in the data box.

        The difference is usually quite small. It is correct sometimes and about 1 tick or so off at a fair few places. But I'm confused why there is any in the first place.

        Comment


          #5
          Here is an attached screenshot with databox.
          Attached Files

          Comment


            #6
            Reviewing this, the Keltner uses the Typical price to calculate the middle SMA line, while the Bollinger uses the closing price.

            Code:
            //Keltner
            double middle	= SMA(Typical, Period)[0];
            
            //Bollinger
            
            double smaValue    = SMA(Period)[0];
            You can review the logic used to calculate these indicators by going to Tools--> Edit NinjaScript--> Indicator.
            MatthewNinjaTrader Product Management

            Comment


              #7
              Thanks, that helped. I deleted typical from the code in that line and now the keltner seems to be working as I would have expected.

              I'm not very good with C# yet, do you think this deletion would affect anywhere else in the indicator?

              Comment


                #8
                Hello,

                Its going to change how the bands are calculated since they're offset from the middle line, but if you prefer this to be calculated from the Close price, it shouldn't cause any problems for you.
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  Sounds good. Thanks.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by giulyko00, Yesterday, 12:03 PM
                  3 responses
                  12 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by habeebft, Today, 07:27 AM
                  1 response
                  14 views
                  0 likes
                  Last Post NinjaTrader_ChristopherS  
                  Started by AveryFlynn, Today, 04:57 AM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Started by Max238, Today, 01:28 AM
                  4 responses
                  38 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by r68cervera, Today, 05:29 AM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X