cummdd#

swordfish.function.cummdd()#

Cumulatively calculate the maximum drawdown for the input X. Null values are ignored in calculation.

Parameters:
  • X (Constant) – A numeric vector, indicating the input data for calculating maximum drawdown (MDD), commonly cumulative return (or rate).

  • ratio (Constant, optional) –

    A Boolean scalar indicating whether to express the MDD in ratio or absolute value.

    • true (default): Return the ratio of MDD over the peak.

    \[\begin{align*} \frac{\max_{t\in(0,T)} X_t - X_T}{\max_{t\in(0,T)} X_t} \end{align*}\]
    • false: Return the absolute value of MDD.

    \[\begin{align*} \max_{t\in(0,T)} X_t - X_T \end{align*}\]