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

Accessing plot properties

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

    Accessing plot properties

    Hi,

    If possible, what is the syntax for accessing the color of a plot?

    What I'm doing is coloring some other objects the same color as the plot, and trying to avoid adding separate user parameters for colors of each of the other objects. So, if I have a line like this:

    Add(new Plot(Color.Blue, PlotStyle.Line, "Upper"));

    there is a user parameter in the indicator setup to select a color. Ideally, I'd like to be able to access whatever that color is, programmatically.

    #2
    Originally posted by coolmoss View Post
    Hi,

    If possible, what is the syntax for accessing the color of a plot?

    What I'm doing is coloring some other objects the same color as the plot, and trying to avoid adding separate user parameters for colors of each of the other objects. So, if I have a line like this:

    Add(new Plot(Color.Blue, PlotStyle.Line, "Upper"));

    there is a user parameter in the indicator setup to select a color. Ideally, I'd like to be able to access whatever that color is, programmatically.
    Search the Help for PlotColors.

    Comment


      #3
      Thanks Koganam,

      The most relevant link I can find is this one:



      which doesn't address the question of programmatically accessing a color property of an already added plot. Did you have some other help page in mind?

      Thanks

      Comment


        #4
        Originally posted by coolmoss View Post
        Thanks Koganam,

        The most relevant link I can find is this one:



        which doesn't address the question of programmatically accessing a color property of an already added plot. Did you have some other help page in mind?

        Thanks
        I am not sure, because your link is to the root of the help index. However, this is the link that I expected that you would reach: http://www.ninjatrader.com/support/h...plotcolors.htm

        Comment


          #5
          Originally posted by koganam View Post
          I am not sure, because your link is to the root of the help index. However, this is the link that I expected that you would reach: http://www.ninjatrader.com/support/h...plotcolors.htm
          Indeed, that's the page I was looking at. No where that I can see does it show the syntax to reference the color of a plot. Yes, it does how how to specify a color. That's not what I need. I want to find out what the color assigned to a plot is, in another part of the code.

          Comment


            #6
            Hi coolmoss,

            You can get the default color with:
            Print(SMA(14).Plots[0].Pen.Color.ToString());

            Plot colors changed dynamically through PlotColors property are not available from another indicator.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Thanks Ryan, I think that'll do the trick!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Shansen, 08-30-2019, 10:18 PM
              24 responses
              938 views
              0 likes
              Last Post spwizard  
              Started by Max238, Today, 01:28 AM
              0 responses
              3 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by rocketman7, Today, 01:00 AM
              0 responses
              2 views
              0 likes
              Last Post rocketman7  
              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  
              Working...
              X