MMTMMT Docs
Diagnostics

S005

collection capacity must be known before the script runs

S005

Set the collection capacity using a literal, constant, or declared input default so it is known before the script runs.

Failing example

script "example"
data chart = subscribe(data.ohlcv)
on chart.update {
  let capacity = int(chart.close ?? 1.0) ?? 1
  let values = int[](capacity)
}

Corrected example

script "fixed"
data chart = subscribe(data.ohlcv)
on chart.update { let values = int[](4) }

On this page