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

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 ScottWalsh, Today, 06:52 PM
            0 responses
            2 views
            0 likes
            Last Post ScottWalsh  
            Started by ftsc2022, 10-25-2022, 12:03 PM
            5 responses
            255 views
            0 likes
            Last Post KeyonMatthews  
            Started by ScottW, Today, 06:09 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Board game geek, 10-29-2023, 12:00 PM
            14 responses
            244 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Waxavi, 04-19-2024, 02:10 AM
            4 responses
            56 views
            0 likes
            Last Post sonia0101  
            Working...
            X