Resetting a summed array

I have some variable for which I’m taking a running sum with Cum().

The sum starts from the first bar, but it needs to"reset" back to zero after certain events, like a Sell or Cover, and then start the sum again until the next event.

Is this possible to do? I’m on Amibroker 5.4

Version 5.40 is not supported.

Newest versions (6.06 or higher) have SumSince function that does what you need efficiently.