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 FrazMann, Today, 11:21 AM
          0 responses
          1 view
          0 likes
          Last Post FrazMann  
          Started by geddyisodin, Yesterday, 05:20 AM
          8 responses
          51 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          10 responses
          36 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by DayTradingDEMON, Today, 09:28 AM
          4 responses
          24 views
          0 likes
          Last Post DayTradingDEMON  
          Started by George21, Today, 10:07 AM
          1 response
          19 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Working...
          X