- sum of array elements since condition was tru

Moving averages, summation
(AmiBroker 6.10)

SYNTAX SumSince( condition, array, incFirst = False )
FUNCTION The function calculates running sum of array elements since condition was true. It works like:

x = Cum( array ) - ValueWhen( condition, Cum( array ) );

or like:

x = Sum( array, BarsSince( condition ) );

but much faster.

When incFirst is set to True, the sum includes the very first value at the bar when condition was true.

SEE ALSO Cum() function , Sum() function , BarsSince() function , ValueWhen() function


The SumSince function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.