Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Possible Bug: Regression Channel Drawing Tool

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

    Possible Bug: Regression Channel Drawing Tool

    Hi there,

    I think there might be an issue with the Regression Channel Drawing tool when its set on "Segment" mode. One side of the channel often snaps close to the regression line. Sometimes both channel lines are on the same side of the regression line.

    I've attached screenshots of an example of this. Screenshots are from today's session start and Friday's session ES 03-19 RTH. Timezone is GMT+0.

    #2
    Hello Kevin,

    Thanks for opening the ticket and providing some screenshots showing how this can be set up.

    After reviewing, I do see this behavior, but it would be considered an expected limitation since the behavior is the same for NinjaTrader 7.

    If you would like, we can submit a new feature request for different behavior behind this tool to improve it.

    Let me know if this is something that interests you.
    Last edited by NinjaTrader_Jim; 02-04-2019, 11:58 AM.

    Comment


      #3
      Hey Jim, thanks for getting back to me. I had a look at this myself and fixed the bug. Please forward this patch to the developer who owns this features so he/she can approve and commit the change if they wish
      • @RegressionChannel.cs
      • Delete Lines 212 - 271 and replace with:

      Code:
                
      
      if (ChannelType == RegressionChannelType.Segment)
      {
            double upperDistance = double.MinValue;
            double lowerDistance = double.MaxValue;
      
            var getIndex = startIndex > endIndex ? x => startIndex - x : (Func<int, int>)(x => endIndex - x);
      
            for (int count = 0; count < barsTotal; count++)
            {
                  var regressionAtBar = count * slope + intercept;
                  var highAtBar = baseBars.GetHigh(getIndex(count));
                  var lowAtBar = baseBars.GetLow(getIndex(count));
                  upperDistance = Math.Max(upperDistance, highAtBar - regressionAtBar);
                  lowerDistance = Math.Min(lowerDistance, lowAtBar - regressionAtBar);
             }
      
             upperStartPrice = middleStartPrice + upperDistance;
             upperEndPrice = middleEndPrice + upperDistance;
             lowerStartPrice = middleStartPrice + lowerDistance;
             lowerEndPrice = middleEndPrice + lowerDistance;
      }
      Last edited by kevinenergy; 02-05-2019, 02:11 AM.

      Comment


        #4
        Hello Kevin,

        Thanks for the patch.

        The results look consistent when testing and I have submitted your requested changes for review up the chain. After analysis, we have found the changes make the Segment calculation closer to Raff Regression channels which we do have a pending feature request for. As your change correctly implements Segment as seen in a Raff Regression channel, we have attached your patch to our Raff Regression change feature request.

        Because the study behind the Regression Channel has changed, it may not be considered for immediate implementation because it may be code breaking for some applications.

        The ticket ID for Raff Regression where we are tracking this item is SFT-1984.

        Thanks for submitting the fix for our consideration!
        Last edited by NinjaTrader_Jim; 02-09-2021, 08:09 AM.

        Comment


          #5
          Hey Jim - sorry for the late response was away snowboarding. No problem on the patch - glad to help!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          88 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          30 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          34 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          68 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X