CS2012
error This returns got values but expected names are given.
#What it means
A function returns several values (a tuple) and the [a, b, ...] on the left does not have the same number of names.
#Typical cause
- Too few or too many names when unpacking, for example two names for
ta.macd, which returns three values.
#How to fix it
Give one name per returned value. Use _ for a value you do not need. See Functions.
#Example
//@chartscript 1
indicator("MACD")
const [macdLine, signalLine] = ta.macd(close, 12, 26, 9)
plot(macdLine)
plot(signalLine)Fixed
//@chartscript 1
indicator("MACD")
const [macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
plot(macdLine)
plot(signalLine)#Related
- CS2013 — This call returns no value.