Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS2009

error name is not a function.

#What it means

Something is called with ( ) as if it were a function, but it is a value such as a variable or a built-in series.

#Typical cause

  • A variable with the same name as a function you meant to call.
  • Parentheses after a built-in variable, as in close() or bar_index().

#How to fix it

Remove the parentheses to use the value, or call the right function. If a variable hides a function you need, rename the variable.

#Example

ChartScriptError: CS2009
//@chartscript 1
indicator("Length")
const len = 14
plot(len(close))

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Length")
const len = 14
plot(ta.sma(close, len))
  • CS2001 — name is not defined.
  • CS2013 — This call returns no value.

The ChartScript documentation is in English for now; translations will follow.