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.
    JimNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        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 CortexZenUSA, Today, 12:53 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by CortexZenUSA, Today, 12:46 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by usazencortex, Today, 12:43 AM
          0 responses
          5 views
          0 likes
          Last Post usazencortex  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          168 responses
          2,266 views
          0 likes
          Last Post sidlercom80  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X