Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multi-Color plot using PlotStyle.Bar
Collapse
X
-
Multi-Color plot using PlotStyle.Bar
I am new to NinjaTrader and have made a simple SMA indicator using PlotStyle.Line that changes color based on it rising or falling. When using PlotStyle.Bar I can't get the color to change. How do you implement a multi-color bar?Tags: None
-
Hello spongeb0b,
You can use PlotBrushes to color bar type plots. The sample from the help guide works for that type. This is also a simple way to demonstrate that just using the close price:
Code:if (IsRising(Close)) PlotBrushes[0][0] = Brushes.Blue; else if (IsFalling(Close)) PlotBrushes[0][0] = Brushes.Red; else PlotBrushes[0][0] = Brushes.Yellow;
-
Jesse, thank you for your response. I realized after reading my question again that I wasn't very clear about what I was asking. If you think of a line plot as a single contiguous line then the example code you gave changes it's color back and forth. In other words that single line can take on 3 different colors. I want to do the same thing for a single bar when the style is PlotStyle.Bar. So for example a single bar could take on 3 different colors. I am using OnEachTick and setting values and switching colors intrabar. What I'm noticing is that when I set a value for the plot a.k.a. bar and switch colors it just re-paints the entire bar with the last color set. If I set the bar to 25 and color it red, then set the bar to 50 and color it green, and set it to 75 and color it yellow, I want the same bar to show all 3 colors at the values they were set.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
637 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
366 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
107 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
571 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment