Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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

    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, 12:24 PM.
        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 CortexZenUSA, Today, 12:53 AM
          0 responses
          2 views
          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