What are community scripts

The TradingView Community Scripts section contains three types of scripts you can use: indicators, strategies, and libraries. They have many similarities, but each specific type of script is tailored for its own use case.


Indicators

Indicators are general-purpose scripts that can perform any calculations programmed by the author and display them on a chart. They can be something very simple, like a moving average, or complex, like a screener that monitors dozens of symbols and looks for several different signals. The alert functionality that the indicators have allows you to get notified when some specific condition is met; it can be set up by either the user of the author of the indicator.

You can find community scripts in the Indicators, metrics, and strategies dialogue on the upper toolbar or in the Community Scripts section.

Strategies

Strategies are tailored for backtesting, i.e., testing an existing trading strategy on historical data to check its viability. They provide you with a vast array of functions to emulate real-life trading. You can specify your initial capital and position size, emulate commission and margin trading, use different order types that allow you to create profit/loss brackets and trailing stops, and much more.

Strategies are calculated by a strategy engine that creates position entries and exits and displays them on the chart. For extra precision, the engine emulates intrabar price movements to execute price-based orders correctly.

Strategies also support the alert functionality; along with alerts set up by the author of the script, they can also send notifications whenever a position changes.

You can find strategies in the Indicators, metrics, and strategies dialogue at the upper toolbar or in the Community Scripts section. In the former, strategies are additionally denoted with a special symbol.

Once loaded on a chart, you can access an indicator's or strategy's configuration parameters using the Settings dialog box, accessible from the script's pop-up menu. Strategies include an additional Properties tab to configure parameters specific to backtesting, such as initial capital and commission.

Strategies also display entries and exits on the chart with the arrow markers and show detailed backtesting information in the Strategy Tester pane under the chart.

Libraries

Libraries are publications containing functions that can be reused in Pine Script® indicators, strategies, or other libraries. They are useful for defining frequently used functions so their source code doesn't have to be included in every script where they are needed. Once a library is published, other scripts can import it via the "import" keyword. Libraries are meant to be imported in code, not added to the chart directly. To access them, filter for libraries in the Community Scripts section.

There are three different types of published scripts: open-source, protected, or invite-only.

! Note: Libraries are always published open-source.

For more information on script publishing, refer to the "Publishing" section of our Pine User Manual.