Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS1010

error Tabs and spaces are mixed in this block's indentation.

#What it means

In the earlier syntax, blocks (the lines under an if, a loop or a function) were made by indentation, and the lines of one block had to use either tabs or spaces, not both. 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 braces { } make the blocks and indentation is free.

#Typical cause

  • Some lines of a block are indented with a tab and others with spaces.
  • Code pasted from another editor brought its own indentation style with it.

#How to fix it

Open the script in the editor: it converts it to the current syntax, where blocks are written in braces. To keep the earlier text, re-indent the block with one kind of indentation. See Conditionals.

#Example

In the earlier syntax

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

Fixed (the current syntax)

ChartScriptOpen in editor
//@chartscript 1
indicator("Bar direction")
let dir = 0
if (close > open) {
    dir = 1
    dir = dir + 1
}
plot(dir)
  • CS1011 — Unexpected indentation.
  • CS1012 — This line's indentation does not match any open block.

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