# Indicators

An indicator (study) is a mathematical function built based on trading statistics such as opening and closing prices, minimum and maximum prices, trading volumes, and more. You can make predictions about the future movement of the market by analyzing changes in values of the indicator. The values of indicator functions can be displayed on the chart in the form of lines, columns, points, and geometric figures. For more information about indicators, refer to the [Technical Indicator](https://www.investopedia.com/terms/t/technicalindicator.asp) article.

![Indicator](/img/indicator.png)

## Built-in indicators

Advanced Charts and Trading Platform support more than 100 indicators. Refer to [Indicators List](https://charting-library-docs.xstaging.tv/latest/ui_elements/indicators/Indicators-List.md) to see all available indicators.

## Custom indicators

You can create your custom indicators in JavaScript. Refer to [Custom Studies](https://charting-library-docs.xstaging.tv/latest/custom_studies.md) for more information. Note that [Pine Script®](https://www.tradingview.com/pine-script-docs/) is not supported in the libraries.

## Add an indicator

Indicators can be added [in the UI](#ui) and [using the API](#api).

### UI

Users can add indicators in the UI as demonstrated below.

![Indicator in UI](/img/add-indicator-ui.gif)

Users can also change the indicator's parameters in the _Settings_ dialog.

![Indicator Settings dialog in UI](/img/indicator-settings-ui.gif)

:::info

Users cannot see or change the code of built-in or custom indicators.

:::

### API

You can use the [`createStudy`](../../api/interfaces/Charting_Library.IChartWidgetApi.md#createstudy) method to add an indicator to the chart. The method has the `inputs` parameter that allows you to specify an indicator's options. To get a list of options available for a certain indicator, call the [`getStudyInputs`](../../api/interfaces/Charting_Library.IChartingLibraryWidget.md#getstudyinputs) method and pass the indicator's name as a parameter. Note that the indicator's name should match the one provided in the drop-down list.

```javascript
widget.getStudyInputs('MACD');
```

The code sample below demonstrates how to create an indicator.

```javascript
widget.activeChart().createStudy('MACD', false, false, { in_0: 14, in_1: 30, in_3: 'close', in_2: 9 });
widget.activeChart().createStudy('Moving Average Exponential', false, false, { length: 26 });
widget.activeChart().createStudy('Stochastic', false, false, { in_0: 26 }, {"%d.color" : "#FF0000"});
widget.activeChart().createStudy('Price Channel', true, false, { in_0: 26 }, null, {checkLimit: false, priceScale: 'new-left'});
```

## Add and compare new series

Users can add new [series](https://charting-library-docs.xstaging.tv/latest/resources/glossary.md#series) to the chart to compare symbols. To do this in the UI, users should click the _Compare or Add Symbol_ button. They can also specify a price scale and display the new symbol on a new pane.

![Compare in UI](/img/compare-indicator-ui.png)

To add a symbol programmatically, you should use the _Overlay_ indicator.

```javascript
widget.activeChart().createStudy('Overlay', true, false, { symbol: 'IBM' });
```

Alternatively, you can use the _Compare_ indicator that allows you to additionally specify the data source. However, unlike _Overlay_, this indicator does not support the [_Allow extend time scale_](https://charting-library-docs.xstaging.tv/latest/custom_studies/Studies-Extending-The-Time-Scale.md#for-overlay-study) feature or logos in the [_Legend_](https://charting-library-docs.xstaging.tv/latest/ui_elements/Legend.md#display-logos).

```javascript
widget.activeChart().createStudy('Compare', false, false, { source: 'open', symbol: 'IBM'});
```

### Enable spread operators

**Spread operators** are operators that allow comparison between a financial instrument, such as a stock,
and an additional variable, such as another financial instrument or a numerical value.

To display spread operators, include the [`show_spread_operators`] and [`compare_symbol_search_spread_operators`]
featuresets in the [`enabled_features`] array.

![Spread operators in the Compare Symbol dialog](/img/spread-operators-in-compare-symbol.png)

## Visibility customization

### Hide indicators

You can use the [`studies_access`](../../api/interfaces/Charting_Library.ChartingLibraryWidgetOptions.md#studies_access) property of the [Widget Constructor](https://charting-library-docs.xstaging.tv/latest/configuration/Widget-Constructor.md) to customize the list of indicators available to users. For example, you can hide some indicators or only make them available to certain users.
Check out the [Widget Constructor tutorial](https://youtu.be/bdvmM3FNnSY?t=1035&feature=shared) on YouTube for an implementation example.

### Hide volume-based indicators

If your datafeed does not provide volume data and you want to hide all volume-based indicators, you should add the indicators below to the blacklist in [`studies_access`](../../api/interfaces/Charting_Library.ChartingLibraryWidgetOptions.md#studies_access).

- Accumulation/Distribution
- Chaikin Money Flow
- Ease of Movement
- Elders Force Index
- Klinger Oscillator
- Money Flow Index
- Net Volume
- On Balance Volume
- Price Volume Trend
- VWAP
- Volume Oscillator

### Hide the Volume indicator

The library adds the _Volume_ indicator to all financial instruments that have volume data. If you do not want to show this indicator, you should include the [`create_volume_indicator_by_default`](../../customization/Featuresets#create_volume_indicator_by_default) featureset in the [`disabled_features`] array.

### Limit indicator amount

You can use the [`study_count_limit`](../../api/interfaces/Charting_Library.ChartingLibraryWidgetOptions.md#study_count_limit) property of the [Widget Constructor](https://charting-library-docs.xstaging.tv/latest/configuration/Widget-Constructor.md) to set the maximum amount of indicators that can be displayed on the chart simultaneously.

![Limit exceeded](/img/limit-indicator.png)

## Style customization

You can use the [`studies_overrides`](../../api/interfaces/Charting_Library.ChartingLibraryWidgetOptions.md#studies_overrides) property of the [Widget Constructor](https://charting-library-docs.xstaging.tv/latest/configuration/Widget-Constructor.md) to specify the indicator's default parameters such as colors, line width, a plot type, and more. Refer to the [Indicator Overrides](https://charting-library-docs.xstaging.tv/latest/customization/overrides/indicator-overrides.md) article for more information on how to customize an indicator.

## Indicator API

After an indicator is created, you can manage it using `IStudyApi`.
For example, you can change the indicator's visibility or position. Refer to [`IStudyApi`](../../api/interfaces/Charting_Library.IStudyApi) for more information.

[`compare_symbol_search_spread_operators`]: https://charting-library-docs.xstaging.tv/latest/customization/Featuresets.md#compare_symbol_search_spread_operators
[`disabled_features`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.ChartingLibraryWidgetOptions#disabled_features
[`enabled_features`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.ChartingLibraryWidgetOptions#enabled_features
[`show_spread_operators`]: https://charting-library-docs.xstaging.tv/latest/customization/Featuresets.md#show_spread_operators

---

## 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)
