# Custom indicators

Advanced Charts and Trading Platform support more than 100 [indicators](https://charting-library-docs.xstaging.tv/latest/ui_elements/indicators.md).
You can also create your custom indicators in JavaScript using the library's API. The API allows you to create a variety of indicators using different plot types, styles, colors, and mathematical functions.

Users can [add a custom indicator](https://charting-library-docs.xstaging.tv/latest/ui_elements/indicators.md#add-an-indicator) to the chart and change some indicator parameters using the _Indicators_ and _Settings_  dialog in the UI, respectively. However, users cannot create their own indicators or change the code of the existing ones.

:::info

[Pine Script®](https://www.tradingview.com/pine-script-docs/) is not supported in the libraries.

:::

## Add indicators

To add custom indicators to the library, specify a function that returns a Promise object with an array of custom [indicator objects](#indicator-object). Assign this function to the [`custom_indicators_getter`](../api/interfaces/Charting_Library.ChartingLibraryWidgetOptions.md#custom_indicators_getter) property in the [Widget Constructor](https://charting-library-docs.xstaging.tv/latest/configuration/Widget-Constructor.md).

```javascript
custom_indicators_getter: function(PineJS) {
    return Promise.resolve([
        // Indicator objects
        {
            // ...
        },
        {
            // ...
        },
    ]);
},
```

## Indicator object

A custom indicator is an instance of [`CustomIndicator`](../api/interfaces/Charting_Library.CustomIndicator.md) that contains the following fields:

- `name`: an indicator's internal name that is not visible in the UI. This name should be unique.
- `metainfo`: the field that describes how the indicator looks like. This field defines the [plot](https://charting-library-docs.xstaging.tv/latest/resources/glossary.md#plot) types that represent the indicator and contains information, such as an indicator's name, description, style, color, and more. Refer to the [Metainfo](https://charting-library-docs.xstaging.tv/latest/custom_studies/metainfo.md) article for more information.
- `constructor`: the field that contains functions `init()` and `main()`. You should specify data calculations in these functions. Refer to [Constructor](https://charting-library-docs.xstaging.tv/latest/custom_studies/custom-indicator-constructor.md) for more information.

```javascript
custom_indicators_getter: function(PineJS) {
    return Promise.resolve([
        {
            // Indicator object
            name: 'Custom indicator name',
            metainfo: {
                // ...
            },
            constructor: function() {
                // ...
            }
        }
    ]);
},
```

## Examples

Follow the links below to explore some implementation examples of custom indicators.

- [Requesting data for another ticker](https://charting-library-docs.xstaging.tv/latest/custom_studies/Custom-Studies-Examples.md#requesting-data-for-another-ticker)
- [Coloring bars](https://charting-library-docs.xstaging.tv/latest/custom_studies/Custom-Studies-Examples.md#coloring-bars)
- [Advanced Coloring Candles](https://charting-library-docs.xstaging.tv/latest/custom_studies/Custom-Studies-Examples.md#advanced-colouring-candles)
- [Custom styles for every point](https://charting-library-docs.xstaging.tv/latest/custom_studies/Custom-Studies-Examples.md#custom-styles-for-every-point)
- [Complex filled areas](https://charting-library-docs.xstaging.tv/latest/custom_studies/Custom-Studies-Examples.md#complex-filled-areas)
- [OHLC plots](https://charting-library-docs.xstaging.tv/latest/custom_studies/Custom-Studies-OHLC-Plots.md)
- [Advanced Shapes use](https://charting-library-docs.xstaging.tv/latest/custom_studies/Custom-Studies-Examples.md#advanced-shapes-use)

---

## Sitemap

- [All documentation pages](https://charting-library-docs.xstaging.tv/llms.txt)
- [Full page map with headings](https://charting-library-docs.xstaging.tv/docs_map.md)
