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
//@chartscript 1
indicator("Close", overlay = true)
plot(close, color = color.orange, "Close")Fixed (the current syntax)
//@chartscript 1
indicator("Close", { overlay: true })
plot(close, "Close", { color: color.orange })