---
name: max_drawdown
kind: function
lang: go
domain: finance
version: "1.0.0"
purity: pure
signature: "func MaxDrawdown(values []float64) (maxDD float64, start, end int)"
description: "Calcula el maximo drawdown de una curva de equity, retornando la magnitud y los indices pico-valle."
tags: [finance, drawdown, risk, metric]
uses_functions: []
uses_types: [drawdown_result_go_finance]
returns: [drawdown_result_go_finance]
returns_optional: false
error_type: ""
imports: []
params:
  - name: values
    desc: "slice de valores de equity curve o net worth (ej: [1000, 1200, 900, 1100, 800])"
output: "tupla (maxDD, start, end) - drawdown como ratio [0,1] (ej: 0.333 = 33.3%), índice de pico, índice de valle"
tested: false
tests: []
test_file_path: ""
file_path: "functions/finance/max_drawdown.go"
---

# max_drawdown

Calcula el maximo drawdown (caida maxima desde un pico hasta un valle) como fraccion del pico. Retorna la magnitud (0 a 1) y los indices de inicio y fin.

## Ejemplo

```go
dd, s, e := finance.MaxDrawdown([]float64{100, 120, 90, 110, 80})
// dd = (120-80)/120 = 0.3333, s = 1, e = 4
```
