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

Array of Plots

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

    Array of Plots

    Hi,

    would it be possible, instead of declaring plots as

    public DataSeries MyPlot1
    {
    }

    public DataSeries MyPlot2
    {
    }

    etc... to use arrays instead? something like

    public DataSeries MyPlots[0]
    {
    }

    Then values in plots could be referred to as MyPlots[x][y]

    I'm not sure how you would add the plots since they are strings.

    Or possibly a dataseries array pointer?


    Thanks
    Will.

    #2
    Hello Will,

    Thank you for your post.

    Plots will need to be DataSeries to represent a value per bar. If you need multiple dimensions, why not use multiple plots instead?

    Comment


      #3
      Because, when referring to these plots from another indicator it makes it much easier to refer to an array of dataseries, rather than coding a switch statement to determine which plot to refer to.

      Comment


        #4
        Originally posted by dontpanic View Post
        Because, when referring to these plots from another indicator it makes it much easier to refer to an array of dataseries, rather than coding a switch statement to determine which plot to refer to.
        The Plots are already a collection. Maybe I misunderstand?

        Comment


          #5
          or maybe I'm misunderstanding...

          if I have 2 plots in my chart, say MyPlot0 and MyPlot1 I refer to their respective values as MyPlot0[x] and MyPlot1[y].

          I want to be able to refer to them as MyPlots[0][x] and MyPlots[1][y]

          Comment


            #6
            Originally posted by dontpanic View Post
            or maybe I'm misunderstanding...

            if I have 2 plots in my chart, say MyPlot0 and MyPlot1 I refer to their respective values as MyPlot0[x] and MyPlot1[y].
            Those are not Plots: they are indexed values of the Plots; doubles.

            I want to be able to refer to them as MyPlots[0][x] and MyPlots[1][y]
            Plots are already a collection.

            The first defined Plot is Plots[0];
            The second defined Plot is Plots[1] et.c.

            So refer to the Plots collection directly. That collection already exists. There is no MyPlots collection, so that syntax is wrong.

            Comment


              #7
              Perfect,

              I'll give that a go.

              Comment


                #8
                But can I access plot values from Plots[]?

                If I want to access the value of Plots[0] at 5 bars ago, how would I do that? I can't write Plots[0][5] and there are no other properties or methods that I can see to do it.

                hmmm.... would that be GetValue? something like Plots.GetValue(0,5)?
                Last edited by dontpanic; 05-26-2015, 08:50 PM.

                Comment


                  #9
                  Hello dontpanic,

                  Thank you for your response.

                  Use Values[0][x]. Please refer to the following link for information on Values: http://www.ninjatrader.com/support/h...nt7/values.htm

                  Comment


                    #10
                    Got it thanks.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by wzgy0920, 04-20-2024, 06:09 PM
                    2 responses
                    27 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 02-22-2024, 01:11 AM
                    5 responses
                    32 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 04-23-2024, 09:53 PM
                    2 responses
                    49 views
                    0 likes
                    Last Post wzgy0920  
                    Started by Kensonprib, 04-28-2021, 10:11 AM
                    5 responses
                    193 views
                    0 likes
                    Last Post Hasadafa  
                    Started by GussJ, 03-04-2020, 03:11 PM
                    11 responses
                    3,235 views
                    0 likes
                    Last Post xiinteractive  
                    Working...
                    X