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

pivots for R4 and S4

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

    pivots for R4 and S4

    I attached my pivots2 file which is the ninja provided pivot except to save changes I had to rename it.
    I wanted to add R4 and S4 and did add it everywhere--private double, Added plotcolors under initialize, added formulas, added R4.Set(r4) and for S4, and added them to Properties but it wont print pivot lines just shows all 9 blocks on the DataBox but no numbers just the colors.
    Using "// " if I remove R4.Set(r4 and for S4 as well as removing Add plotcolors for R4 and S4 then everything is fine thru R3 and S3.
    What am I missing to get R4 and S4?. I attached the file with the 2 types above '//' out.
    Attached Files

    #2
    Hello simpletrades,

    In the supplied script I see 7 plots defined. Values[0] through Values[6].

    However, there public dataseries attempting to return Values[7] and Values[8] which do not exist.

    Please see the help guide on how Add(new Plot()) and Values works.
    Add() - http://ninjatrader.com/support/helpGuides/nt7/add.htm
    Values - http://ninjatrader.com/support/helpG...nt7/values.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I think that's because I put the code back to the way it at least would plot thru R3 and S3 which meant I had to remove 2 pieces of R4and S4 to make it work.
      Attached is the same file but with nothing removed that mentions R4 or S4. This way prints nothing on charts but does show in dataseries as blue/green but no prices.
      Does this answer your question?
      Attached Files

      Comment


        #4
        Hello simpletrades,

        I have not asked a question.
        This version in your last post has Values[7] and Values[8] as there are 9 plots added.

        However, I'm hitting a invalid index error when testing the script.
        Are you checking the Log tab of the Control Center for errors?
        Do you see any errors and if so, what do these say?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          In Properties the points S1-R4 do go 1-8 but above them is also the 9th set at 0 so its 0-8.
          [Browsable(false)]
          [XmlIgnore]
          public DataSeries PP
          {
          get { return Values[0]; }//3
          }

          Comment


            #6
            Hello simpletrades,

            The updated script in post #3 has the correct amount of plots.

            There is another issue.
            Are you checking the Log tab of the Control Center for errors?
            Do you see any errors and if so, what do these say?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              it says this but I don't know what it means--said ... the 'Plot' method was outside the bounds of the array.
              Attached Files

              Comment


                #8
                Hello simpletrades,

                The error message is first letting you know this is a logic error in either OnBarUpdate() or Plot().

                The message 'Index was outside the bounds of the array' is an indexing error that applies to arrays, lists, collections, and series.

                See the forum thread about using brackets:


                As an example if an array:
                int[] myArray = new int[3] {};

                has 3 elements (myArray[0], myArray[1], and myArray[2]) and we attempt to call an index that doesn't exist like myArray[3] or myArray[4], this will cause an indexing error because an index doesn't exist.

                You will need to debug the script first and figure out which line is causing the error.
                Add prints to OnBarUpdate() and Plot(). See which print is the last print to appear before the error occurs.

                As a heads up, in the support department at NinjaTrader we do not create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

                You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.

                However, I will continue to guide you if you would like to debug this script yourself.

                This thread will also remain open for any community members that would like to correct this script as a convenience to you.
                Last edited by NinjaTrader_ChelseaB; 02-21-2017, 04:16 PM.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  That's all gibberish to me but I don't see how brackets can be off since I copied the code each time about S3 and R3 and adjusted it for R4 and S4 including ' ; '

                  Comment


                    #10
                    Hello simpletrades,

                    There is a logic issue where an index is being called that does not exist.
                    You need to identify the line with the logic error and correct this.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      This pivot indicator displays 5 support and 5 resistance levels.



                      The indicator is open source ... you could copy parts of the code.

                      One problem with your indicator is that it does not have enough SolidBrushes (line 28). You have only 7 SolidBrushes, but 9 Plots. You need to add two SolidBrushes. This could have caused the index issue explained by ChelseaB.

                      Comment


                        #12
                        Gracias, the problem is that's the only Spanish word I know.

                        Comment


                          #13
                          Hi traderforexfx,

                          I've removed your post. This promotional post was not a solution to the inquiry of this thread.
                          Chelsea B.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by GLFX005, Today, 03:23 AM
                          0 responses
                          1 view
                          0 likes
                          Last Post GLFX005
                          by GLFX005
                           
                          Started by XXtrader, Yesterday, 11:30 PM
                          2 responses
                          11 views
                          0 likes
                          Last Post XXtrader  
                          Started by Waxavi, Today, 02:10 AM
                          0 responses
                          6 views
                          0 likes
                          Last Post Waxavi
                          by Waxavi
                           
                          Started by TradeForge, Today, 02:09 AM
                          0 responses
                          12 views
                          0 likes
                          Last Post TradeForge  
                          Started by Waxavi, Today, 02:00 AM
                          0 responses
                          2 views
                          0 likes
                          Last Post Waxavi
                          by Waxavi
                           
                          Working...
                          X