• 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

Problem with adding plots

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

    Problem with adding plots

    Greetings,

    Can I get an explanation as to why I cannot add variables/plots to my indicators? Although it compiles there is no plot being made...

    #region Variables
    double VSLOPE; double VSLOPE2; double VSLOPE_DIFF; double VSLOPE_ROC;
    #endregion
    protectedoverridevoid Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "ROC"));
    }
    protectedoverridevoid OnBarUpdate()
    {
    VSLOPE = TRENDSLOPE[0]; VSLOPE2 = TRENDSLOPE[1]; VSLOPE_DIFF = Math.Abs(VSLOPE - VSLOPE2); VSLOPE_ROC = Math.Abs(VSLOPE_DIFF / VSLOPE2);
    ROC.Set(VSLOPE_ROC);
    }

    Any explanation would be GREATLY appreciated, it is very frustrating to not have these plots and not know why...

    #2
    Not sure what TRENDSLOPE[] is, but check your logs for errors. Use print functions to debug at each step.

    You will also most likely need to watch out for division by 0.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Does your ROC have a DataSeries?

      Do you have something like this in your code?

      #region Properties

      [Browsable(false)]
      [XmlIgnore()]
      public DataSeries ROC
      {
      get { return Values[0]; }
      }

      #endregion

      Comment


        #4
        Thanks for the replies. Yes I do have the commands in the Properties similar to as shown. What is a "Plot method: Overflow Error"??

        Is there a way to have Plot info display in the "Data Box" however NOT PLOT on the indicator display itself? I simply want a quick and easy way to view the data values, not necessarily anything displayed visually...I'm trying to plot the data for 1 plot but only display the values in the Data Box for another...

        Comment


          #5
          >> "Plot method: Overflow Error"
          Where have you seen this.
          a) on a NT standard indicator? which one or
          b) on a custom indicator? or
          c) on a custom indicator where you have overwitten the Plot() method?
          DierkNinjaTrader Customer Service

          Comment


            #6
            Hi,

            On a custom indicator where I have added a Plot() method, not overwritten...the original Plot() is still there. The error is in the log.

            Comment


              #7
              - can you reproduce this issue in the logs?
              - are you on latest 6.5.1000.1?
              DierkNinjaTrader Customer Service

              Comment


                #8
                Yes on both questions.

                Comment


                  #9
                  Originally posted by Burga1 View Post

                  protected override void OnBarUpdate()
                  {
                  VSLOPE = TRENDSLOPE[0]; VSLOPE2 = TRENDSLOPE[1]; VSLOPE_DIFF =
                  I suspect that the solution is that you need to add the following before you attempt to access "[1]"...

                  Code:
                  if (CurrentBar < 1) return;

                  Comment


                    #10
                    Yes, I have such a condition already. Here is the complete code within OnBarUpdate:

                    if(CurrentBar < 50){return;}
                    Print(Time[
                    0].ToString()); Print("Current CurrentBar = " + CurrentBar);

                    TRENDSLOPE.Set(Slope(FIBTREND(
                    1).Middle, 2, 0));
                    //VSLOPE = TRENDSLOPE[0]; VSLOPE2 = TRENDSLOPE[1]; VSLOPE_DIFF = Math.Abs(VSLOPE - VSLOPE2);
                    //VSLOPE_ROC = Math.Abs(VSLOPE_DIFF / VSLOPE2); ROC.Set(VSLOPE_ROC);

                    The above works fine with everything commented out as displayed. When I "uncomment" those lines that causes the "re-producable" error in the log about the Overflow...

                    Comment


                      #11
                      When VSLOPE2 == 0 it would cause an overflow. divided by 0.

                      Comment


                        #12
                        Well, when all else fails, you can always open the Output window and just pepper your code with Print statements.

                        But it sounds like you need to do this in your Plot() method.

                        If you add the Print statements and open your Output window, it will become obvious what's going on (or at least what statement is objectionable). This is generally just a 5 to 10 minute exercise, start to finish.

                        Comment


                          #13
                          divide by 0 errors normally appear in the log...do they not? I know I've seen them before there so I assume they always do so.

                          Comment


                            #14
                            Divide by zero would display an error in the log... if it gets that far.

                            What I would do is this: put in some Print statements and see.

                            It's less typing to put in a Print statement than to answer this post!

                            Comment


                              #15
                              Originally posted by Burga1 View Post
                              Yes on both questions.
                              Great. Please send this info to "christian AT ninjatrader DOT com" and refer to this post:
                              - your custom indicator in question
                              - your zipped DB (e.g. by Help->Mail to support)
                              - which instrument is this?
                              - which indicator settings have you applied?

                              Thanks
                              DierkNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ksarin, Today, 12:39 PM
                              3 responses
                              9 views
                              0 likes
                              Last Post NinjaTrader_PatrickG  
                              Started by ttodua, Today, 12:03 PM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by tomtr27, Today, 11:35 AM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Uregon, Today, 07:30 AM
                              2 responses
                              9 views
                              0 likes
                              Last Post bltdavid  
                              Started by Induna, 02-20-2020, 05:38 AM
                              4 responses
                              26 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Working...
                              X