PDA

View Full Version : Help with Color Bar indicator


MrPips55
10-21-2008, 01:04 PM
This simple ColorBar indicator is not working. Can someone help?
Here is the code:
====================
protected override void OnBarUpdate()
{
//Are there enough bars
//if (CurrentBar < Period) return;
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.

if (Close[0] > Open[0] && Close[0] > High[1])
{
BarColor = Color.Blue;
}
else if (Close[0] < Open[0] && Close[0] < Low[1])
{
BarColor = Color.Red;
}

else if (Close[0] >= Low[1] && Close[0] <= High[1])
{
BarColor = Color.Black;
}

}
===============
end
thanks!!!

NinjaTrader_Ben
10-21-2008, 03:00 PM
Hello,

Please put this at the top of your OnBarUpdate() block and see if it helps:

if(CurrentBar < 1) return;

(Or just delete the "//" marks from left of the CurrentBar condition you already have.)

This link will help:
http://www.ninjatrader-support.com/vb/showthread.php?t=3170

What is probably happening is you are referring to an index of 1 before it exists.

prostyle
10-25-2008, 03:28 PM
Hello,

If you have the paint bar indicator or have ben able to get one do you mind sharing?

I use only bars when trading, I see there are lots of heikin ashi indicators
in this forum but nothing for strickly bars?

Please let me know, if I have to pay I will.

thanks,

Colin