Gives an imported library a short name: import user/library/1 as lib makes lib.function() available.
as appears once, in an import line. The name after it is the alias that stands for the library in the rest of the script, so import yourname/MathTools/1 as mt lets you write mt.smoothed(...). The alias must be a plain identifier that does not clash with a built-in namespace such as ta or math.
Pick an alias that tells the reader where the function comes from; with two imports the alias is what keeps their functions apart.
Remarks
- Two imports cannot share an alias.
- On Sidechair: the alias is recorded and calls through it warn once and return na.
Example
//@version=6
indicator("Alias", overlay = true)
import yourname/MathTools/1 as mt
import yourname/Levels/3 as lv
plot(close, "Close", color.gray)
plot(mt.smoothed(close, 20), "Smoothed", color.blue)
plot(lv.support(low, 50), "Support", color.green)See also
Runs on Sidechair