Pine libraries are a special type of script publication useful to Pine programmers. They are not to be confused with TradingView's Community Scripts, which is where all public Pine scripts are published on our platform.
Pine Libraries are scripts containing functions that can be reused in other Pine scripts, be they indicators, strategies, or other libraries. They are useful to define frequently-used functions so their source code does not have to be included in every script where they are needed.
Because they provide access to easily reusable code, Libraries themselves are not supposed to be applied to the chart. Instead, while writing a script you need to import the library with the special keyword. To do this quickly, use the “Copy … to clipboard” button available on the published library’s page. An in-depth tutorial on writing and using Libraries can be found in our User Manual.
All libraries are published open-source. Public scripts can only use public libraries. Private scripts or personal scripts saved in the Pine Editor can use public or private libraries. A library can use other libraries, or even previous versions of itself.
Public libraries are considered public domain code in our House Rules on Script Publishing, which entails that, contrary to open-source indicators and strategies, permission is not required from their author if you reuse their functions in your open-source scripts. If you intend to reuse a public library’s functions in a public, closed-source publication (protected or invite-only), explicit permission for reuse in that form is required from its author.
With the provision that public Pine libraries are considered to be “public domain”, our reuse of open-source rules, which you can find in our House Rules on Script Publishing, apply to them.