Metadata / Reference
library
TradingView-compatible spelling: library, runs without warnings
Defines the script as a reusable library header. Pine v6 libraries are imported via `import author/libraryName/version`. The body may contain `export` function declarations that become callable from importing scripts.
library(title, overlay, dynamic_requests) → voidParameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
title | string | Yes | — | Library title. |
overlay | bool | No | — | Whether library helpers default to drawing on the main chart (informational; the engine ignores this for the library header itself). |
dynamic_requests | bool | No | — | When true allows callers to invoke `request.*` family from within exported functions (Pine v6). |
Returns
voidExample
library
library("My Toolkit", overlay=true)export hl2avg(simple int len) => ta.sma(hl2, len)Notes
- Use only one script header: indicator OR strategy OR library OR study.
- Pine v6 `export` prefix declares a function callable from importing scripts. The keyword is accepted; in the script itself the function works as a normal function.
Names and aliases
Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.