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 gentlebenthebear, Today, 01:30 AM
                  2 responses
                  13 views
                  0 likes
                  Last Post gentlebenthebear  
                  Started by Kaledus, Today, 01:29 PM
                  2 responses
                  7 views
                  0 likes
                  Last Post Kaledus
                  by Kaledus
                   
                  Started by frankthearm, Yesterday, 09:08 AM
                  13 responses
                  45 views
                  0 likes
                  Last Post frankthearm  
                  Started by PaulMohn, Today, 12:36 PM
                  2 responses
                  16 views
                  0 likes
                  Last Post PaulMohn  
                  Started by Conceptzx, 10-11-2022, 06:38 AM
                  2 responses
                  56 views
                  0 likes
                  Last Post PhillT
                  by PhillT
                   
                  Working...
                  X