Rolling Max Drawdown Pass Node

Rolling Maximum Drawdown — Series Input

StatisticalRiskPass

Overview

The Rolling Max Drawdown Pass Node computes the maximum peak-to-trough decline within a rolling window. It measures the worst loss experienced within any rolling period, expressed as a positive fraction.

Unlike the Drawdown node (which tracks cumulative drawdown from the all-time peak), Rolling Max Drawdown resets each window — ideal for regime-aware risk management or strategy evaluation.

Formula

For each rolling window of size period:
peak[j] = max(values[i−period+1 .. j]) for j in window
drawdown[j] = (peak[j] − value[j]) / peak[j]
rollingMDD[i] = max(drawdown[j]) for j in window
Output is always ≥ 0. 0 = no drawdown in window; 0.3 = 30% peak-to-trough decline.

Parameters

ParameterDefaultDescription
period20Rolling window in bars

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Any positive numeric series (equity curve, price)
valuesOutput(number | null)[]Rolling max drawdown in [0, 1]; nulls during warm-up
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Position Sizing Risk Control

Scale position size inversely to rolling max drawdown — reduce exposure when recent drawdowns are elevated.

Strategy Stop Condition

Pause a strategy if rolling MDD exceeds a threshold (e.g. 10%) — an automated circuit breaker for drawdown-sensitive strategies.

Regime Identification

High rolling MDD periods correspond to volatile or trending regimes; low rolling MDD indicates calmer, range-bound conditions.

Tips & Best Practices

Apply to Equity Curves

Most useful when applied to a strategy's cumulative equity series, not raw price — measures the strategy's own recent worst-case loss.

Rolling vs Cumulative

Rolling MDD resets each window and may be lower than the lifetime MDD. For worst-ever drawdown from inception, use the Drawdown node instead.

Use in Calmar Ratio

Divide annualised return by rolling max drawdown to build a rolling Calmar ratio for dynamic performance evaluation.

Related Indicators