PDA

View Full Version : Testing for a color


Mike Winfrey
09-18-2007, 09:19 AM
I know this is kind of off the wall but I have an indicator that colors the 100 line a specific color based on some internal rules that I don't have visibility of. Wondering if there is any way to test for a specific color of the 100 line.

Thanks,
Mike

NinjaTrader_Josh
09-18-2007, 10:56 AM
If you are setting the color dynamically there is probably a variable that is passed around that contains the color. If you can find the name of that variable then you can check the color.

Mike Winfrey
09-18-2007, 11:28 AM
Thanks Josh...the indicator isn't mine and is encrypted. So, I don't have visibility much except what shows in the indicator properties.

Mike

NinjaTrader_Josh
09-18-2007, 01:42 PM
Hi Mike,

From my understanding you are calling this indicator with another indicator/strategy and you want to do something if this indicator's line is some color. Is this correct?

You can do so by going something like this:
if (ProtectedIndicator.Lines[0].Pen.Color == Color.Red)
// Do something

Hopefully you know the exact color he used on the line or else the comparison wouldn't match up and your condition would never be satisfied.

Mike Winfrey
09-18-2007, 03:40 PM
Thanks Josh...this is really close but no cigar yet. His indicator properties tell me exactly what the color is so that isn't a problem. the problem is now that I put that line of code in the indicator and it compiles without complaint. But when I reload the script, nothing prints in the output window. However, when I comment out that line I get all my normal output in the output window. Just so you know, I am using the exact code you suggested except I substituted the correct indicator name of course.

thanks, Mike

NinjaTrader_Josh
09-18-2007, 04:16 PM
Its going to be hard to tell. See if he used a plot instead of a line for coloring. Replace the ".Lines" with ".Plots". I think that will work. Also look in the error logs to see if anything popped up.

Mike Winfrey
09-19-2007, 05:08 AM
Already tried plots and nothing there. I guess there just aren't enough clues to take this any further.

thanks for your help...At least I learned something.

Mike