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 Mindset, 04-21-2026, 06:46 AM
|
0 responses
62 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
86 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
46 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
104 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
63 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment