Count and CountInclusive

Top  Previous  Next

Example chart for this topic:  CountInclusive and CountSinceInclusive.cht

Count(condition1, condition2, condition series, reset flag)

Parameters:
Condition 1 – the beginning of the counting period that is defined by a time series that must be a condition (default Close should not be used)
Condition 2 – the ending of the counting period that is defined by a time series that must be a condition (default Close should not be used)
Condition series - the condition that is being counted, i.e., all bars on which the condition series is not zero are counted
Reset flag – an integer number 0 or 1 (default 1).

CountInclusive(condition1, condition2, condition series, reset flag)

Same as Count except that the bars on which conditions 1 and 2 occur are included in the count if they are true.

Counts how many times the condition series is a non-zero value (true)  between the last occurrence of condition2 and the immediately preceding occurrence of condition1, exclusive of the bars on which conditions 1 and 2 occur.

Reset Flag
The reset flag parameter controls how the indicator calculates when there are several repeating occurrences of condition2 after an occurrence of condition 1.

Reset flag = 1 (default) The Count indicator calculates on the same bar when condition2 takes place after an occurrence of condition1. The Count indicator recalculates at all repeating occurrences of condition2.

The indicator output is a horizontal line that begins on the same bar where condition2 occurs (exclusive of that bar) and continues up until the next bar where condition2 occurs in the next condition1/condition2 pair (exclusive of that bar). If the reset flag is set to 1, it effectively tells the indicator to “forget” about the condition1 value before the occurrence of the first condition2, and so on.

Reset flag = 0 The Count indicator calculates once on the same bar when the first occurrence of condition2 is found after an occurrence of condition1. The Count indicator does not recalculate if condition2 repeats.

Note: The Count and CountInclusive indicators use close as a default parameter value when a condition is required. Close is a non-zero value so it is always a true condition.  However, you should not pay attention to these indicator results until you change the close to a condition that may be either true or false.