From that thread, I gather that I should use DrawDot rather than Plot when the dots are not to be drawn on every bar.
I have this working for a condition based on the current bar, but it fails when I try to make the condition refer to previous bars.
So, using this condition, I can get the dots to display correctly.
if (Close[0] < Open[0])
But, if I try to refer to previous bars, like this:
if (Close[0] < Open[1])
-- the code does not work. So, I assume it is the condition itself which I am getting wrong.
Can anybody explain why this change would stop the code working, and how I would correctly refer to previous bars?
Any help appreciated.
Here's the rest of the code.
protected override void OnBarUpdate()
{
{
//if (Close[0] < Open[0])
if (Close[1] > Open[1])
//if(Close[1] < Close[0] && Close[1] < Close[2])
{
myBarCloses=1;
} else {
myBarCloses=0;
}
if (myBarCloses==1)
{
DrawDot(CurrentBar.ToString() +"BarCloseDot",true, 0, Low[0]*0.997, Color.Magenta);
}
}
}

Comment