Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Regression Channel

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

    Regression Channel

    How do I plot Regression Channel dynamically as dashed line and blue color within NinjaScript?? I am proficient in C# and I have tried using “DrawRegressionChannel()” inside the OnBarUpdate() and Initialize() methods without any success. A code snippet would be great or any suggestions of where to look?


    Thanks for your support.

    TazManII

    #2
    Please see here: http://www.ninjatrader-support.com/H...onChannel.html

    I suggest trying with a simple drawing method like DrawDot and then take it from there http://www.ninjatrader-support.com/H...6/DrawDot.html
    DierkNinjaTrader Customer Service

    Comment


      #3
      Regression Channel

      I tried and it doesn't plot anything. Below is my code snippet. I am trying to plot regression channel around pivot points.

      protectedoverridevoid Initialize()
      {
      Add(
      new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
      RegressionChannel(6
      , 2).Plots[0].Pen.DashStyle = DashStyle.Dash;
      CalculateOnBarClose =
      true;
      Overlay =
      true;
      PriceTypeSupported =
      false;
      }

      protectedoverridevoid OnBarUpdate()
      {
      Plot0.Indicator.DrawRegressionChannel("Reg Ch",true,6,0,Color.Blue,DashStyle.Dash,2,Color.Blue,DashStyle.Dash,2,Color.Blue,DashStyle.Dash,2);
      Plot0.Set(Close[
      0]);
      }

      Comment


        #4
        The fishy line here is this one: Plot0.Indicator.DrawRegressionChannel("Reg Ch",true,6,0,Color.Blue,DashStyle.Dash,2,Color.Blue,DashStyle.Dash,2,Color.Blue,DashStyle.Dash,2);

        You do not need to do Plot0.Indicator. Please see the Control Center for any subsequent errors too.

        All you need to do is use this syntax and drop it in: DrawRegressionChannel(string tag, bool autoScale, int startBarsAgo, int endBarsAgo, Color upperColor, DashStyle upperDashStyle, int upperWidth, Color middleColor, DashStyle middleDashStyle, int middleWidth, Color lowerColor, DashStyle lowerDashStyle, int lowerWidth)
        Last edited by NinjaTrader_JoshP; 05-31-2008, 11:24 AM.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Regression Channel

          Josh,

          Thanks very much. Your suggestion to see the Control Center for any subsequent errors helped fixed my problem. The problem was startBarsAgo and endBarsAgo were out of valid range.

          Once again many thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Rubens_2020, Today, 01:48 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by kempotrader, Today, 01:34 PM
          1 response
          22 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by bc24fl, Today, 01:50 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by vantojo, Today, 01:39 PM
          0 responses
          14 views
          0 likes
          Last Post vantojo
          by vantojo
           
          Started by bosajin, 01-21-2021, 09:15 AM
          7 responses
          58 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Working...
          X