Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS1011

error Unexpected indentation.

#What it means

In the earlier syntax, a line was indented although nothing above it opened a block. 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 indentation is free.

#Typical cause

  • A stray indentation at the start of a line.
  • A line that was meant to continue the previous line.

#How to fix it

Open the script in the editor to convert it to the current syntax, or remove the indentation.

#Example

In the earlier syntax

ChartScriptError: CS1011
//@chartscript 1
indicator("Range")
rng = high - low
        avg = ta.sma(rng, 14)
plot(rng)

Fixed (the current syntax)

ChartScriptOpen in editor
//@chartscript 1
indicator("Range")
const rng = high - low
const avg = ta.sma(rng, 14)
plot(avg)
  • CS1012 — This line's indentation does not match any open block.
  • CS1034 — Expected a block { … }.

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