Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS1012

error This line's indentation does not match any open block.

#What it means

In the earlier syntax, when a block ended the next line had to line up with one of the blocks still open, and this line did not. 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 a block ends at its }.

#Typical cause

  • A line indented by 2 spaces after a block indented by 4.
  • Mixed indentation widths after copying code.

#How to fix it

Open the script in the editor to convert it to the current syntax, or indent the line to the width of the block it belongs to.

#Example

In the earlier syntax

ChartScriptError: CS1012
//@chartscript 1
indicator("Bar direction")
dir = 0
if close > open
    dir := 1
  dir := dir * 2
plot(dir)

Fixed (the current syntax)

ChartScriptOpen in editor
//@chartscript 1
indicator("Bar direction")
let dir = 0
if (close > open) {
    dir = 1
}
dir = dir * 2
plot(dir)
  • CS1011 — Unexpected indentation.
  • CS1010 — Tabs and spaces are mixed in this block's indentation.

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