Diagnostics
S018
lambda or collection transform in setup or state initializer
S018
Setup expressions and state initializers run once when the script starts and cannot loop over elements, so lambdas and map/filter/reduce cannot appear there. Run the transform inside a handler and keep the source data in setup or state.
Failing example
script "conf"
data chart = subscribe(data.ohlcv)
setup base = [1.0, 2.0]
setup doubled = base.map(|x| x * 2.0)
on chart.update {
let first = doubled.get(0)
}Corrected example
script "fixed"
data chart = subscribe(data.ohlcv)
setup base = [1.0, 2.0]
on chart.update {
let doubled = base.map(|x| x * 2.0)
let first = doubled.get(0)
}