Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS2103

error The argument param of name must be a constant.

#What it means

This argument must be a constant: a value the compiler can work out from the script text alone, such as a literal or an expression of literals. Inputs and bar values are not allowed here.

#Typical cause

  • An input or a variable passed where the compiler needs a fixed value, for example as the title of alert.on.
  • An input or a variable as the calc_bars_count of request.tf, request.market, request.lower_tf or request.market_lower_tf (the depth of a request is fixed when the script compiles: write the number, up to 20,000).
  • An options list that contains non-constant values.

#How to fix it

Write the value directly in the code (a literal, or a const variable). See Series and qualifiers.

#Example

ChartScriptError: CS2103
//@chartscript 1
indicator("Alert")
const title = input.string("Up bar", "Alert title")
alert.on(close > open, title)
plot(close)

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Alert")
alert.on(close > open, "Up bar")
plot(close)
  • CS2104 — The argument param of name must be a constant or an input.
  • CS2101 — The argument param of name must be the same on every bar (needed), but this value is got.
  • CS2711 — The argument param of name must be a constant.

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