• 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

Creating a Regression Channel

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

    Creating a Regression Channel

    Hello,

    I am working on creating a regression channel using the DrawRegressionChannel() function built into NT.

    Is it possible using this function to set some sort of Regression Factor to change the width of the channel?

    Thanks.
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    #2
    DrawRegressionChannel() does not return any values you can use. RegressionChannel() is the indicator you should call to get values for the channel.
    JoshNinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply Josh. I'll look into that.
      mrlogik
      NinjaTrader Ecosystem Vendor - Purelogik Trading

      Comment


        #4
        Hey Josh.

        Using DrawRegressionChannel() does not input a width for the number of stand devs, yet RegressionChannel() does not have this input. My code is as such.

        Code:
        DrawRegressionChannel(    CurrentBar.ToString(), false, 0, bSinceLineUp, 
                                                    Color.White, DashStyle.Solid, 1, 
                                                    Color.White, DashStyle.Dash, 1, 
                                                    Color.White, DashStyle.Solid, 1);
        Where bSinceLineUp is the number of bars used for the calculation.

        How can I get the Upper / Lower channel values using RegressionChannel() indicator call if to .Upper / .Lower if RegressionChannel() uses requires a width input, but the DrawRegressionChannel() does not. Does DrawRegressionChannel() have a default value of width of 1?

        Thanks for your help.
        mrlogik
        NinjaTrader Ecosystem Vendor - Purelogik Trading

        Comment


          #5
          Hi,

          Not sure I follow. The Regression Channel indicator does have a width input.
          Code:
          RegressionChannel(int period, int width)[int barsAgo]
          I guess I'm not sure what you are asking.
          JoshNinjaTrader Customer Service

          Comment


            #6
            Hey Josh.

            I'm plotting right now using the DrawRegressionChannel() as i posted previously. This function does not have a width input.

            I want to reference the Upper / Lower channel lines of this. I understand (or I think I understand) that I can use the RegressionChannel() call to find the Upper / Lower channel lines using the same period I used for DrawRegressionChannel, then referencing the .Upper / .Lower variables from RegressionChannel(). If this is true, what would I have to set the width input for RegressionChannel() to, to have the same channel.

            Basically what I'm asking is how can I create the same channel using both
            DrawRegressionChannel and RegressionChannel?

            Thanks again
            mrlogik
            NinjaTrader Ecosystem Vendor - Purelogik Trading

            Comment


              #7
              Ok. I see what you mean. The width drawn by the regression channel draw object is determined by the setting you have set for the draw object's default. Double click on the draw object to bring up the properties window. Default is 2 std devs.
              JoshNinjaTrader Customer Service

              Comment


                #8
                Yes, that is what I was looking for.

                Thanks.
                mrlogik
                NinjaTrader Ecosystem Vendor - Purelogik Trading

                Comment


                  #9
                  IRegressionChannel, DrawRegressionChannel, RegressionChannel relationship...

                  I understand.
                  Last edited by funk101; 10-05-2014, 03:42 PM. Reason: I get it now, whatever your default settings are for the indicator is what is created "on the fly"

                  Comment


                    #10
                    RegressionChannel width for Midpoint

                    So I get that you can do:

                    IRegressionChannel rchannel = DrawRegressionChannel("rchannel_", Bars.BarsSinceSession, 0, Color.Blue);

                    and what gets created is a Regression Channel that utilizes the default settings in the actual RegressionChannel indicator(in this case "2");

                    // lower
                    RegressionChannel(rchannel.StartBarsAgo, rchannel.StdDevLower).Lower[0];

                    // upper
                    RegressionChannel(rchannel.StartBarsAgo, rchannel.StdDevUpper).Upper[0];

                    // midpoint
                    RegressionChannel(rchannel.StartBarsAgo, ??); what does midpoint use as a width?

                    Do all 3 lines use the same width? In the case 2, 2, 2 for Upper, Lower and Midpoint?
                    In this example the rchannel object only has the upper and lower values exposed.

                    Comment


                      #11
                      Hello funk101,

                      Thank you for your post.

                      If you are just calling their value, they have no width. If you are adding them to the chart via Add() then they will use the default settings.
                      Patrick H.NinjaTrader Customer Service

                      Comment


                        #12
                        If I remove the width as in:

                        // midpoint
                        RegressionChannel(rchannel.StartBarsAgo)[0];



                        It throws an error: "No overload method for RegressionChannel takes 1 arguments"
                        Last edited by funk101; 10-05-2014, 09:52 PM.

                        Comment


                          #13
                          Hello funk101,

                          Thank you for your response.

                          The width parameter is the number of std deviations to calculate the channel lines. This is a user configured setting, but if you are trying to use the same values as if you were calling them from the same instance of the indicator, then they would use the same value.
                          Patrick H.NinjaTrader Customer Service

                          Comment


                            #14
                            So, since my default is "2" then I would use 2 for mid, lower, and upper, correct?

                            // lower
                            RegressionChannel(rchannel.StartBarsAgo, 2).Lower[0];

                            // upper
                            RegressionChannel(rchannel.StartBarsAgo,2).Upper[0];

                            // midpoint
                            RegressionChannel(rchannel.StartBarsAgo, 2);

                            Comment


                              #15
                              Hello Funk101,

                              That is correct.
                              Patrick H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Atilla, Yesterday, 04:05 PM
                              1 response
                              49 views
                              1 like
                              Last Post im197
                              by im197
                               
                              Started by vevbarrq, Today, 12:11 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post vevbarrq  
                              Started by johnnybegoode, Yesterday, 10:16 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post johnnybegoode  
                              Started by reedstickets, Yesterday, 07:53 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post reedstickets  
                              Started by Displacer, Yesterday, 02:57 PM
                              2 responses
                              17 views
                              0 likes
                              Last Post Displacer  
                              Working...
                              X