Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS1020

error Unexpected character char.

#What it means

The script contains a character that has no meaning in ChartScript, outside a string or a comment.

#Typical cause

  • A symbol ChartScript does not use, such as @, # outside a colour, or the single & and | (logic is written && and ||).
  • A "smart" quote or another look-alike character pasted from a document.
  • An invisible character, shown in the message as U+ and its code.

#How to fix it

Delete or replace the character. "And" is &&, "or" is ||, and strings use plain ", ' or ` quotes. See Operators.

#Example

ChartScriptError: CS1020
//@chartscript 1
indicator("Up bars")
const up = close > open & volume > 0
plot(up ? 1 : 0)

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Up bars")
const up = close > open && volume > 0
plot(up ? 1 : 0)
  • CS1021 — This string is not closed on the same line.

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