I would like to ask if anyone knows how to access the background color of a chart programatically? I am specifically referring to the color you set in Chart properties under Window and then Background color. I change the background color as part of my indicator set ups and I would like to revert to the original color via the program when I am done. Thank you.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Accessing Chart Background Color
Collapse
X
-
Accessing Chart Background Color
Hi,
I would like to ask if anyone knows how to access the background color of a chart programatically? I am specifically referring to the color you set in Chart properties under Window and then Background color. I change the background color as part of my indicator set ups and I would like to revert to the original color via the program when I am done. Thank you.Tags: None
-
Hello Zeos6,
Thank you for your post.
We do not have a supported method to access the chart color properties, however another member may have some experience they can share with you.
You can always use the BackColor property to access the color value that an indicator is using.
if (BackColor == Color.Green)
// do something
More information on BackColor can be found below:
MatthewNinjaTrader Product Management
-
ChartControl.BackColorOriginally posted by Zeos6 View PostThank you Mathew. I am aware of what you have indicated.
I understand that you do not have a supported method to access the Chart Properties but can you at least tell me where they are stored; i.e. System.Control.... or System.Windows.Forms...
Thank you.
Comment
-
I normally do not work weekends, I'm filling in for a colleague who is out enjoying the summer, but we normally have techs scheduled working the weekend.
In the case you wish to change the background under a specific condition, you may use the supported 'BackColor" property:
MatthewNinjaTrader Product Management
Comment
-
That is nice to know, that somebody is available at weekends. :-)
I know BackColorAll, but it colors only the background of bars an not the whole chart background.
Imagine, you have 10 charts on yours screen and just need to glance at it to know which is trending.
Thanks
Thomas
Comment
-
Thomas,
In that case, you'd have to use the ChartControl property in OnBarUpdate:
Code:protected override void OnBarUpdate() { if(Close[0] > SMA(5)[0]) ChartControl.BackColor = Color.Green; else if(Close[0]< SMA(5)[0]) ChartControl.BackColor = Color.Red; }MatthewNinjaTrader Product Management
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
651 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment