Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS2601

error A field cannot be named name.

#What it means

A few names (__proto__, constructor and prototype) cannot be used for fields of a type, because they are reserved inside the engine that runs scripts.

#Typical cause

  • A field named after one of these words.

#How to fix it

Rename the field, for example proto or template. See User types, enums and methods.

#Example

ChartScriptError: CS2601
//@chartscript 1
indicator("Zones")
type Zone {
    top: float
    prototype: float
}
const z = Zone.new(high)
plot(z.top)

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Zones")
type Zone {
    top: float
    template: float
}
const z = Zone.new(high)
plot(z.top)
  • CS1027 — name is reserved and cannot be used as a name.
  • CS2602 — A type can have at most max fields.

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