COUNTIFS Function

You are here:
< All Topics

Returns a vector representing the total number of times the specified condition evaluated to TRUE. You can use the standard version or the with-reset version.

Syntax:
COUNTIFS(condition)
or
COUNTIFS(condition, reset condition)

Example: 

SET SMA = SMA(CLOSE,14)
SET SELL = CROSSOVER(CLOSE,SMA)

//Standard version
COUNTIFS(CROSSOVER(SMA, CLOSE)) 
or
//With reset version
COUNTIFS(CROSSOVER(SMA, CLOSE),SELL) 

The script returns a vector with increasing values expressing the number of times the 14-day Simple Moving Average crossed over the closing price. On the reset version, the count resets on the sell condition.

Previous IF Function
Next CROSSOVER Function
Table of Contents