FlowscopeDocs

T214

destructuring does not match the returned values

Severity Error

let (a, b) = f() must list exactly one name per returned value. Here the number of names differs from the number of values the function returns, or the right-hand side returns a single value.

Match the count. Use _ for results you do not need, for example let (line, _, hist) = ta.macd(chart.close, 12, 26, 9).

Failing example

Flowscope Script
script "MACD histogram"
data chart = subscribe(data.ohlcv)
pane p = pane(title: "MACD", height: 0.25)
plot hist = plot.histogram(title: "Histogram", on: p)
on chart.close {
  let (line, signal) = ta.macd(chart.close, 12, 26, 9)
  hist.plot(line - signal)
}

Fixed example

Flowscope Script
script "MACD histogram"
data chart = subscribe(data.ohlcv)
pane p = pane(title: "MACD", height: 0.25)
plot hist = plot.histogram(title: "Histogram", on: p)
on chart.close {
  let (_, _, h) = ta.macd(chart.close, 12, 26, 9)
  hist.plot(h)
}