# L008

> negative capacity

**Severity** Error

A collection constructor received a negative capacity, which has no meaning.

Use a positive capacity. If the value comes from an input, give the input a `min:` of 1.

## Failing example

```flowscope
script "Recent highs"
data chart = subscribe(data.ohlcv)
state highs = rolling<float>(-20)
plot top = plot.line(title: "Highest of buffer")
on chart.close {
  highs.push(chart.high)
  top.plot(highs.max())
}
```

## Fixed example

```flowscope
script "Recent highs"
data chart = subscribe(data.ohlcv)
state highs = rolling<float>(20)
plot top = plot.line(title: "Highest of buffer")
on chart.close {
  highs.push(chart.high)
  top.plot(highs.max())
}
```

## Related

- [L007](/docs/scripting/reference/diagnostics/l007)
- [S005](/docs/scripting/reference/diagnostics/s005)
