cummax

Syntax

cummax(X)

Please see Cumulative Window Functions (cum-functions) for the parameters and windowing logic.

Details

Cumulatively calculate the maximum values in X. It can be used to calculate maximum drawdown, for example.

Examples

$ x = [7,4,5,8,9]
$ cummax(x);
[7,7,7,8,9]

$ m = matrix(6 5 7 8 1, 3 9 4 2 10);
$ m;

#0

#1

6

3

5

9

7

4

8

2

1

10

$ cummax(m);

#0

#1

6

3

6

9

7

9

8

9

8

10

Related functions: cummin, cumsum, cumprod