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 zstheorist, Today, 07:52 PM
          0 responses
          5 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          150 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          6 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          6 views
          0 likes
          Last Post tkaboris  
          Working...
          X