Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS1003

error The script must start with indicator(...) or library(...) after the header.

#What it means

After the header, a script declares what it is with indicator(...) or library(...). The compiler did not find that declaration where it belongs.

#Typical cause

  • The declaration is missing altogether.
  • Other statements come before it. Only import lines and simple variable declarations may come before the declaration.

#How to fix it

Add indicator("Title") (or library("Name")) right after the header, before plots, calls and other statements.

#Example

ChartScriptError: CS1003
//@chartscript 1
plot(close)

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Close line", { overlay: true })
plot(close)
  • CS1001 — The first line must be //@chartscript 1
  • CS1004 — Only one indicator(...) or library(...) declaration is allowed.

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