> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Pine Script

> Paste a Pine Script indicator from TradingView, what the translation does, and what it refuses.

Bring an indicator from TradingView. Paste a Pine Script® v5 or v6 `indicator()` script into the script editor and it is translated into a TypeScript script when it loads, with any problems reported against your Pine line numbers. **Show as TypeScript** in the editor shows what it became, to read or keep editing.

Pine Script is a registered trademark of TradingView, Inc.

## How Pine maps to a script

| Pine | Here |
| - | - |
| A plain variable | A local inside the chart's `onBar` |
| `var x = ...` | `const x = state.bar(...)` at the top |
| `varip x = ...` | `const x = state.live(...)` |
| `x[n]` | A `series` read with `.ago(n)` |
| `ta.ema(src, 20)` | An instance per call, `ta.ema(20)`, updated where the call was |
| `request.security(syminfo.tickerid, tf, expr)` | A second `bars({ interval })` stream, read closed only |
| `request.security` on another ticker | A stream on that market, for Binance, Bybit and OKX crypto tickers |
| `request.footprint`, `footprint.*` | Built from `trades()`, where the trade history reaches |
| `plot`, `plotshape`, `fill`, `bgcolor`, `barcolor`, `hline` | `plot.line` and the other plots |
| `line.*`, `label.*`, `box.*`, `table.*` | `draw.*` |
| `alertcondition` | `alert` |

`request.security` reads what the other timeframe had closed, which is Pine's behaviour with lookahead off; the public API has no way to look ahead.

## What it refuses

Each with a message saying what to do:

* `strategy()` scripts: strategies come later.
* Pine v4 and older: TradingView's Pine Editor converts a script to a newer version.
* `import` of libraries.
* Data only TradingView has: `request.financial`, `request.economic`, `request.earnings`, `request.dividends`, `request.splits`, `request.seed` and `request.quandl`, and macro tickers such as `TVC:DXY`.

Diagnostics from the translation start with `PN`: `PN1xxx` parsing, `PN2xxx` types and meaning, `PN3xxx` not supported.

## Next step

See [the limits](/terminal/guides/limits) every script runs within.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.