Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change Plot Color

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

    Change Plot Color

    I am using the following code to plot a volume buy/sell indicator histogram. It is supposed to be green when positive and red when negative.
    Instead if the last plot is negative it turns all bars red, and if the last plot is positive it turns all bars green. There must be something funky with my indexing but when I tried to change it I got an error.
    Here's the code:
    HTML Code:
    			if(Value[0] > 0)
    				{
    				 Plots[0].Brush = Brushes.Green;
    				}
    			else
    				{
    				 Plots[0].Brush = Brushes.Red;	
    				}
    				
    I've attached a small picture of the plot.

    What am I doing wrong?

    Thanks

    DaveN
    Attached Files

    #2
    No worries, I figured it out. Need to use PlotBrushes[0][0] = Brushes.Green or red instead.
    It's working fine now.

    Comment


      #3
      Thanks for posting the solution, I had the exact same problem. Despite following the language reference (http://ninjatrader.com/support/helpG...-us/?plots.htm)

      Comment


        #4
        Hello,

        Thanks for your post.

        Based on the comments we will amend our documentation to note that the Plots[0].Brush = Brushes.Blue; example shows the entire series color change and we will add a foot note reference/link to PlotBrushes for the individual element color change.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        144 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        297 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        242 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        339 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        172 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X