FlowscopeDocs

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
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
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())
}