Brings a published library into a script under an alias, written import user/library/version as alias.
import author/Name/version as alias loads one version of a library published by another author. Afterwards, the library's exports are reached through the alias: alias.func(...), alias.Type.new(...), alias.EnumName.field. The version number is an integer, and a script stays on the version it names until you change it.
Each import names a library that has been published, and the script is compiled against exactly that version.
Syntax
import {username}/{libraryName}/{libraryVersion} as {alias}Remarks
- On Sidechair: an import line compiles, but library code does not run yet. Each call through the alias warns once and returns na, and the rest of the script keeps running.
Example
//@version=6
indicator("Import", overlay = true)
import yourname/MathTools/1 as mt
plot(close, "Close", color.gray)
plot(ta.sma(close, 20), "Built-in SMA", color.blue)
plot(mt.smoothed(close, 20), "From the library", color.orange)See also
Runs on Sidechair