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(...)wherelibrary(...)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
//@chartscript 1
indicator("Double")
export const double = (x: float) => x * 2
plot(double(close))Fixed
//@chartscript 1
indicator("Double")
const double = (x: float) => x * 2
plot(double(close))#Related
- CS4007 — path is not a library.