View Full Version : Referencing the Color of a Previous Bar
jfalbert19
04-01-2008, 10:34 AM
Is it possible to access the color property of a previous bar. For example if "X condition" is true, then set current bar color equal to bar color "y" bars ago?
NinjaTrader_Dierk
04-01-2008, 11:11 AM
Unfortunately this is beyond what we provide support for at this time.
e-man
02-17-2009, 04:02 PM
i found a work-around that may/may not help you ...
my task was to color the next X bars after a condition was triggered ... so i started with something as simple as this:
// place this in variables section
private int intCounter = 0; // counter
private int intNumBars = 5; // number of bars to paint
// place this inside of OnBarUpdate()
if ( (...your condition here...) || intCounter > 0)
{
// paint the bar
if (intCounter < intNumBars)
{
BarColor = Color.Red;
}
// increment counter
intCounter = intCounter + 1;
// reset counter after number exceeds max
if (intCounter > intNumBars)
{
intCounter = 0;
}
}
...
i am working on making it toggle/oscillate between two colors as the market reverses, etc.