NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Miscellaneous Support > Historical Version 7 Beta Threads > Version 7 Beta General Questions & Bug Reports

Version 7 Beta General Questions & Bug Reports Ask questions here and post bug reports.

 
 
Thread Tools Display Modes
Old 11-09-2010, 10:43 AM   #1
supernatural
Junior Member
 
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default How to code change of color of a panel background

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.
supernatural is offline  
Old 11-09-2010, 11:05 AM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

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;
}
NinjaTrader_RyanM is offline  
Old 11-09-2010, 02:57 PM   #3
supernatural
Junior Member
 
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default

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?
supernatural is offline  
Old 11-09-2010, 03:38 PM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

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;
}
NinjaTrader_RyanM is offline  
Old 11-09-2010, 05:16 PM   #5
supernatural
Junior Member
 
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default

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?
supernatural is offline  
Old 11-10-2010, 04:32 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Unfortunately this is not supported for programmatic access supernatural.
NinjaTrader_Bertrand is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 09:03 PM.