MMTMMT Docs
Diagnostics

T423

profile length must be known before the script runs

T423

Set bars using a literal, constant expression, or declared input default so the profile length is known before the script runs.

Failing example

script "conf"

data chart = subscribe(data.ohlcv)
data vol = subscribe(data.volume)

on chart.update {
  let n = int(chart.close ?? 1.0)
  let p = vol.profile(bars: n)
  let t = p.total()
}

Corrected example

script "fixed"
data chart = subscribe(data.ohlcv)
data vol = subscribe(data.volume)
on chart.update { let profile = vol.profile(bars: 10)
  let total = profile.total() }

On this page