Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS1035

error Positional arguments must come before named arguments.

#What it means

In a call, arguments given by position must all come before arguments given by name. Only scripts in the earlier syntax (saved before ChartScript moved to its current, brace-based syntax) can show it; the editor converts such a script to the current syntax when you open it, after which this cannot happen. In the current syntax named arguments go in an options object { … }, which must be the last argument (CS1058).

#Typical cause

  • A positional argument after a named one, as in plot(close, color = color.orange, "Close").

#How to fix it

Put the positional arguments first and the named ones in an options object at the end: plot(close, "Close", { color: color.orange }). See Functions.

#Example

In the earlier syntax

ChartScriptError: CS1035
//@chartscript 1
indicator("Close", overlay = true)
plot(close, color = color.orange, "Close")

Fixed (the current syntax)

ChartScriptOpen in editor
//@chartscript 1
indicator("Close", { overlay: true })
plot(close, "Close", { color: color.orange })
  • CS1058 — An options object { … } can only be the last argument of a call.
  • CS2007 — The argument param is given twice.
  • CS2005 — name takes expected arguments, not got.

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