Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS4005

error export can only be used in a library.

#What it means

export makes a function, type, enum or constant available to other scripts, and only libraries can be imported. In an indicator, export has no meaning.

#Typical cause

  • Library code pasted into an indicator.
  • The declaration says indicator(...) where library(...) was meant.

#How to fix it

Remove export, or change the declaration to library("Name") if the script is meant to be shared. See Libraries.

#Example

ChartScriptError: CS4005
//@chartscript 1
indicator("Double")
export const double = (x: float) => x * 2
plot(double(close))

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Double")
const double = (x: float) => x * 2
plot(double(close))
  • CS4007 — path is not a library.

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