Start freeSign in
Research/Glossary/Pine Script

Pine Script

Reference

Pine Script is TradingView’s built in language for creating indicators, strategies, and alerts that run on TradingView charts.

Pine Script is TradingView’s built in language for creating indicators, strategies, and alerts that run on TradingView charts. Its execution model is platform contained. User written Pine code runs inside TradingView rather than as a general purpose program on the user’s machine or on arbitrary external infrastructure.

A sandboxed environment means code is allowed to operate only within a defined set of capabilities. In Pine Script, those capabilities are centered on market series, chart state, built in functions, drawing objects, alert logic, and strategy simulation features exposed by TradingView. The language is designed around these bounded operations instead of unrestricted system access.

This matters for security and operational stability because Pine scripts do not behave like ordinary desktop or server programs. Pine code does not provide general file system access, does not expose arbitrary network request primitives for reaching external endpoints, and does not give scripts direct control over TradingView’s core services. The script works through the interfaces the platform explicitly defines.

The practical mechanism is visible in how Pine is authored and executed. A script declares an indicator, strategy, or library and then evaluates bar by bar within TradingView’s runtime. Data access is mediated by Pine functions such as the built in series model and the request namespace for supported data retrieval tasks inside the platform’s rules. The script does not open its own sockets, launch processes, or read and write local files. It consumes only the data and services TradingView makes available to Pine.

The language design reinforces that boundary. Pine is a domain specific language for chart based analysis, not a general purpose runtime. Its syntax and standard capabilities focus on time series calculations, plotting, drawing, alerts, and backtest style strategy logic. That specialization is part of the sandbox. By narrowing what scripts can do, TradingView limits the ways user code can interfere with other systems.

Isolation also appears in Pine’s resource model. Script execution is governed by platform limits and by language rules that constrain memory use, historical access patterns, object counts, and computational behavior. These limits help prevent a user script from becoming an unrestricted workload that could impair chart rendering or shared platform operations. In this sense, sandboxing is not only about blocking dangerous system calls. It is also about controlling how much work a script can perform and where that work can occur.

For quantitative traders and developers, the tradeoff is straightforward. Pine offers tight integration with TradingView chart data, visual outputs, alerts, and strategy testing, but it does so inside a controlled runtime. That control improves consistency and reduces operational risk at the platform level, while also limiting the kinds of external integrations and system level behaviors that are common in unbounded scripting environments.

Compared with an unsandboxed scripting environment, the difference is one of authority. In an unsandboxed model, a script may be able to access the host operating system, install packages, call arbitrary web services, write files, spawn subprocesses, or interact directly with external databases and services. Pine Script is structured differently. Its authority is delegated by TradingView through a fixed language surface and runtime constraints. The result is isolation of user logic from the platform’s core services and from the broader host environment.

That is why Pine Script is best understood as an embedded platform language rather than a general automation language. Its indicators and strategies run where TradingView permits them to run, with the data TradingView permits them to access, and with the operations TradingView permits them to perform. This sandboxed execution model is what helps maintain platform security and operational stability while still allowing users to build chart based trading logic.

Covered in depth in the Platform comparisons pillar hub.

Apply this and the related checks to your own results with the Backtest Overfitting Audit.Open the audit
ShareXLinkedInFacebookEmail