I created a counter below. It counts bars that are side-by-side (up close / down close or down close / up close)
if (
Close[0] > Open[0] && Close[1] < Open[1] ||
Close[0] < Open[0] && Close[1] > Open[1]
)
{
if (counter == 0)
counter = 2;
else
counter = counter + 1;
Draw.Text(this, "MyText"+CurrentBar, counter.ToString(), 0, ((Open[0] + Close[0]) / 2), Brushes.White);
}
else
counter = 0;
Now, I would like to fine tune it.
I would like to display only the highest count of side-by-side bars as we go along.
For example 6 instead of 2 3 4 5 6
If I remove the 'CurrentBar' in DrawText I am able to achieve that in real-time. However, I then lose the count with all the historical bars.
Unfortunately, I can not figure out how to have both and would appreciate some assistance.
Thank you

Comment