![]() |
|
|||||||
| Version 7 Beta General Questions & Bug Reports Ask questions here and post bug reports. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
Hello,
What's the most straightforward way to programmatically (in an indicator's code) change the background color of a panel? I mean all the background of the panel at once, not just the part corresponding to one given bar. Thanks. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello supernatural,
You can work with BackColorSeries for this. http://www.ninjatrader.com/support/h...olorseries.htm You would have to program a loop that iterates through all bars of the series. if (Close[0] > Open[0]) for (int x = 0; x < CurrentBar, x++) { BackColorSeries[x] = Color.Black; }
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
Hello RyanM,
Thank you. Can the original (unmodified) color be accessed somewhere or do I have to store it in a variable if I want to get it back after I modified the values of BackColorSeries? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
You would have to store it somewhere. Once it's been changed by code, any calls to the BackColor property will return the modified color.
Here's a quick snippet that tests for conditions in real time and changes background colors. When the conditions aren't true, it colors red. Code:
if (!Historical && Close[0] > Open[0])
for (int x = 0; x < CurrentBar; x++)
{
BackColorSeries[x] = Color.Green;
}
else
for (int x = 0; x < CurrentBar; x++)
{
BackColorSeries[x] = Color.Red;
}
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks a lot. I understand the values in BackColorSeries can't be recalled once they're modified but is there a property that contains the background color for the panel as it is defined by the user in the graphical interface?
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
Unfortunately this is not supported for programmatic access supernatural.
Bertrand
NinjaTrader Customer Service |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Change DOM background color | cunparis | Suggestions And Feedback | 22 | 09-28-2011 12:14 PM |
| Change the background color of all the area of an indicator panel | IkerCB | Miscellaneous Support | 2 | 09-08-2010 03:18 AM |
| Any way to change Ninjascript Editor Background Color? | paolfili | Miscellaneous Support | 3 | 10-19-2009 02:37 AM |
| Background Color Change | laocoon | Indicator Development | 2 | 06-15-2009 07:23 AM |
| Change background color | trader2be | Indicator Development | 1 | 11-13-2007 09:13 PM |