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 Mindset, Today, 06:46 AM
        0 responses
        14 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, Yesterday, 05:21 PM
        0 responses
        22 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        16 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        82 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        51 views
        0 likes
        Last Post PaulMohn  
        Working...
        X