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
//@chartscript 1
indicator("Range")
rng = high - low
avg = ta.sma(rng, 14)
plot(rng)Fixed (the current syntax)
//@chartscript 1
indicator("Range")
const rng = high - low
const avg = ta.sma(rng, 14)
plot(avg)