FlowscopeDocs

L001

too many stateful call sites

Severity Error

The script contains more stateful call sites (ta.* calls and other calls that keep history) than one script may use. Each site reserves its own history buffer, and the total is capped to keep memory and the per-batch step budget predictable. The message shows the count and the limit.

Remove indicators you do not plot, share one result between several uses by storing it in a let, or split the work into several scripts.

Failing example

Flowscope Script
script "Everything at once"
data chart = subscribe(data.ohlcv)
plot e1 = plot.line(title: "EMA 1")
on chart.close {
  // imagine several hundred more distinct ta.* calls below
  e1.plot(ta.ema(chart.close, 1))
  log.debug(str.format("{0}", ta.ema(chart.close, 2) ?? 0.0))
  log.debug(str.format("{0}", ta.ema(chart.close, 3) ?? 0.0))
}

Fixed example

Flowscope Script
script "Everything at once"
data chart = subscribe(data.ohlcv)
plot e1 = plot.line(title: "EMA 21")
on chart.close {
  e1.plot(ta.ema(chart.close, 21))
}