Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting Plot Color using Plot Object

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

    Setting Plot Color using Plot Object

    Hi,

    I create a new plot with this code:

    Plot myPlot = new Plot(Color.Black, PlotStyle.Line, "MyPlotName);

    I want to change the plot line color to green:

    myPlot.Pen = new Pen(Color.Green); // This does NOT work

    Plots[0],Pen = new Pen(Color.Green); // This works

    I would like to refer to the plot by name (not index) - what am I doing wrong ?

    Thanks In Advance,

    Bob A.

    #2
    To clarify, are you looking to dynamically change the plot color based on certain conditions?

    If so you'd have to use the Index value from the collection of Plot objects as per the following link:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Matthew View Post
      To clarify, are you looking to dynamically change the plot color based on certain conditions?

      If so you'd have to use the Index value from the collection of Plot objects as per the following link:

      http://www.ninjatrader.com/support/h...plotcolors.htm
      Yes, I'm looking to change the color dynamically based on certain conditions.

      I have lots of plot lines in this custom indicator, and I would rather reference them by name instead of index (in case I add one in the middle later...)

      Comment


        #4
        Originally posted by BAltman View Post
        Hi,

        I create a new plot with this code:

        Plot myPlot = new Plot(Color.Black, PlotStyle.Line, "MyPlotName);

        I want to change the plot line color to green:

        myPlot.Pen = new Pen(Color.Green); // This does NOT work

        Plots[0],Pen = new Pen(Color.Green); // This works

        I would like to refer to the plot by name (not index) - what am I doing wrong ?

        Thanks In Advance,

        Bob A.
        Have you defined the access properties for the Plot?

        Comment


          #5
          Would you explain what you mean by "access properties for the plot" ?

          In the Plot Class Definition help page, the only properties are Min and Max...

          Comment


            #6
            Originally posted by BAltman View Post
            Would you explain what you mean by "access properties for the plot" ?

            In the Plot Class Definition help page, the only properties are Min and Max...
            Can you modify the Plot properties from the PropertyGrid, when you load the indicator on to a chart?

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            580 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            336 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X