Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How do you get the bar color?
Collapse
X
-
How do you get the bar color?
In an indicator, how do you retrieve the bar color? I do not want the "check for conditions" solution.. The indicator I am writing is checking for when another indicator paints the bar, so the check for this/that condition is not an option.Tags: None
-
Hello,
Thank you for the question.
The BarColor property will report as Color.Empty unless the script sets a value for that bar.
The solution is to check the same condition as the other indicator in which paints the bars originally to duplicate the same logic.
Unfortunately unless the other script explicitly exposes a signal or Color series, there is no way around this as the BarColor is only visible for the script that sets it. An example would be:
Indicator 1 sets BarColor to Color.Red for ALL bars.
Indicator 2 Reads BarColor, but it reports as Empty for ALL bars.
This would be expected that each indicator has an empty bar color collection in which it can control the color of each bar.
I look forward to being of further assistance.
-
Hello,
These colors are also not accessible in the way you would like.
You could access the Property that you set and get the Up or Down color for the base colors, but there would be no way to know which bars are each color.
The Bars are colored with these colors based on the conditions of the ChartStyle being used. After this, if an Indicator has a conditions that additionally change the BarColor, these colors would be used for X bar instead of the base series color. The best solution would be if the indicator that is coloring the bars exposes a signal or color series. From that a strategy could tell what each bar color was
I look forward to being of further assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
330 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
548 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
549 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment