SUMIFS(Condition, Vector, Reset Condition)
Last in the “IF” function lineup is the SUMIFS function. This function outputs a running sum of all values in the supplied Vector wherever the supplied Condition evaluates to TRUE. The reset function will reset the sum to zero.
For example if we wanted the sum of volume for all the days where the closing price closed up 5%, we could write:
SUMIFS(CLOSE > REF(CLOSE,1) * 1.05, VOLUME)
The result will be a vector containing a running sum of volume for each day where the closing price closed up at least 5%. If we want to reset the sum, we need to put in a reset condition. We’ll use a sell condition as a reset for this example.
SUMIFS(CLOSE > REF(CLOSE,1) * 1.05, VOLUME, SELL)