Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS2014

error value is not one of the allowed values: options.

#What it means

The argument has to be one of a fixed set of values, and this one is not in the set. The message lists the allowed values.

#Typical cause

  • An input's default value that is not among its own options.
  • A setting such as a language code, a section id or a duration written in the wrong form.

#How to fix it

Use one of the listed values. For an input, either add the default to options or change the default. See Inputs.

#Example

ChartScriptError: CS2014
//@chartscript 1
indicator("Average", { overlay: true })
const kind = input.string("SMA", "Average", { options: ["EMA", "WMA"] })
const ema = ta.ema(close, 20)
const wma = ta.wma(close, 20)
plot(kind == "EMA" ? ema : wma)

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Average", { overlay: true })
const kind = input.string("EMA", "Average", { options: ["EMA", "WMA"] })
const ema = ta.ema(close, 20)
const wma = ta.wma(close, 20)
plot(kind == "EMA" ? ema : wma)
  • CS2008 — Expected expected but got got.
  • CS2716 — The preset preset gives name the value value, which the input does not allow.

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