View Full Version : Reading background color?
Burga1
02-13-2008, 08:15 PM
Hi,
I'd like to know if it is possible to programaticly determine the "background" color of an indicator display (at the bottom of the screen under the price chart)? For example if something like this is possible:
if(Indicator.BackColor == Green){do something;}
Thanks in advance for any help.
NinjaTrader_Dierk
02-13-2008, 10:50 PM
- an indicator has no "background" color
- you can access the color of a plot e.g. by "Plots[0].Pen.Color"
NinjaTrader_Josh
02-13-2008, 11:11 PM
Hi Burga1,
You can paint the indicator panel a certain color though. Please take a look at these two links:
BackColor (http://www.ninjatrader-support.com/HelpGuideV6/BackColor.html)
BackColorAll (http://www.ninjatrader-support.com/HelpGuideV6/BackColorAll.html)
Burga1
02-14-2008, 09:58 AM
Hi,
Thanks for the replies...yes that's what I mean--if an indicator has had the command for "backcolor" executed to change the color...can this be subsequently "read" as per my example in my first post? I simply want to be able to program a strategy to "read" what the indicator backcolor is...
NinjaTrader_Dierk
02-14-2008, 10:09 AM
Yes, it can be accessed as per Josh's post below
Burga1
02-14-2008, 05:09 PM
Thank you, so you're saying that this:
if(Indicator.BackColor == Green){do something;}
is acceptable code?
NinjaTrader_Josh
02-14-2008, 10:20 PM
No. Just do this:
if (BackColor == Color.Green)
// Do something
Burga1
02-14-2008, 10:52 PM
Thanks for the reply. If I'm writing a strategy to access the backcolor within a seperate indicator, is that not possible? Would I have to write the code that sets the backcolor within the strategy then?
NinjaTrader_Josh
02-14-2008, 11:24 PM
Not sure I follow, but maybe you could just expose a property from your indicator that contains values pertaining to the conditions you are searching for and then access those from the strategy.
Here is a reference sample for doing just that: http://www.ninjatrader-support.com/vb/showthread.php?t=4991
Burga1
02-15-2008, 10:04 AM
Thank you.