PDA

View Full Version : Change dynamically the bar's colors


"CJS"
08-06-2010, 09:33 AM
Hi,

I do not understand why the indicator do not color in red the bars when the value of double mmValue is smaller than the value of double mmValueLast.

For some reason the indicator shows all the bars in blue.

Thanks in advance

protected override void OnBarUpdate()
{
if (CurrentBar<trendPeriods)
{
return;
}

double mmValue=WMA(Close,trendPeriods)[0];
double mmValueLast=WMA(Close,trendPeriods)[1];

PlotTrendMA.Set(1);

if (mmValue>mmValueLast)
{
Plots[0].Pen.Color=Color.Blue;
}
else
{
Plots[0].Pen.Color=Color.Red;
}

NinjaTrader_RyanM
08-06-2010, 09:57 AM
Hello CJS,

Thank you for your post.

Please see this tutorial if you're using version 6.5 and want to change indicator colors conditionally:
http://www.ninjatrader-support.com/HelpGuideV6/Overview25.html

Version 7 offers a new approach here. See this post if you are using version 7 and want to do this:
http://www.ninjatrader.com/support/forum/showthread.php?t=21225