I'm trying to count the number of consecutive bars where close[0] < close[4]. I can get it to count but when it encounters close[0] > close [4] and then a new close [0] < close [4]. it continues from the last number counted. how do i get it to reset itself?
So for example, there are 4 bars where each consecutive close is less than their respective close 4 bars ago. The counter would've counted to 4. then it encounters a bar where its close is greater than the close 4 bars ago. it correctly doesn't count it. subsequently it comes across a bar where the close is again lower the the close 4 bars ago. it counts that bar as a '5'. How do i get it to count '1' again?
this is what i have so far:-
if (Close[0]<Close[4])
{
BuySetupCount++;
DrawText((CurrentBar.ToString() + "BS"), BuySetupCount.ToString(), 0, (Low[0]-TickSize), Color.Green);
if (BuySetupCount == 9)
{
BuySetupCount = 0;
}
}
Comment