Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS1022

error Unknown escape sequence esc.

#What it means

Inside a string, a backslash starts an escape sequence. This one is not a known escape.

#Typical cause

  • A file path or other text with single backslashes, such as "C:\data".
  • A \u escape without exactly four hexadecimal digits after it.

#How to fix it

Use one of the known escapes: \\ (a backslash), \", \', \n (new line), \t (tab) or \uXXXX; in a template literal also \` and \$. To show a backslash, write it twice.

#Example

ChartScriptError: CS1022
//@chartscript 1
indicator("Escapes")
const note = "Up\Down"
plot(close, note)

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Escapes")
plot(close, "Up\\Down")
  • CS1021 — This string is not closed on the same line.

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