Skip to main content

API Reference

Structure

The API is structured as a modular system of types, interfaces, and enumerations. The library's API is divided into three modules, where each module consists of interfaces that define properties and methods specific to its functionality.

Charting Library module

The Charting Library module is designed to manage chart creation, customize the UI appearance, and handle user interactions.

Key features

  • Manage drawings and indicators displayed on the chart.
  • Customize chart themes, layouts, and behaviors.
  • Handle user interactions through events and methods.

Common interfaces


Datafeed module

The Datafeed module is designed to integrate custom data sources and controlling data flow to the chart.

Key features

  • Connect any market data source to Advanced Charts.
  • Handle custom symbology logic to map your backend symbols to TradingView's requirements.
  • Synchronize chart data with live market data updates.

Common interfaces


Broker module

The Broker module is designed to integrate trading capabilities provided by Trading Platform.

Key features

  • Enable creating market, limit, and other order types directly from the chart interface.
  • Provide real-time market quotes to power trading features like the Order Ticket, Watchlist, and Depth of Market.
  • Support multiple account setups for users with diverse trading needs.

Common interfaces


Best practices for navigation

  1. Identify the module relevant to your task: creating charts, managing datafeeds, or enabling trading.
  2. Examine the available interfaces within the module. Each interface defines a set of properties and methods relevant to a specific feature or functionality.
  3. Follow type links and explore enumerations. If a property uses a non-primitive type, follow the link to the corresponding type definition. This will reveal additional properties and their relationships.
  4. Get back into the context and use your browser’s navigation to return to higher-level modules or interfaces when needed.

Browse TypeScript definition

Alternatively, if you are more comfortable browsing the API through a TypeScript definition file, you can use the following links:

Keyboard shortcuts for Visual Studio Code

ActionWindows shortcutmacOS shortcut
FindCtrl + FCmd + F
Go to definitionF12 or Ctrl + ClickF12 or Cmd + Click
Go backCtrl + -Cmd + -