Skip to main content
Version: v25

Symbology

The library requires information about the symbol in order to request and process data correctly. This information should be arranged in a specified format and supplied as a LibrarySymbolInfo object. This article explains the most challenging concepts of the LibrarySymbolInfo implementation. You can find the complete list of interface parameters, and their descriptions, in the API section.

The library calls the resolveSymbol method to request symbol information. To provide this information, create the LibrarySymbolInfo object and pass it to ResolveCallback as a parameter.

tip

Refer to the Datafeed API topic for more information on how to supply the chart with data.

Symbol Name

The library addresses a symbol by a unique identifier. You can use full_name or ticker to specify such an identifier for a certain symbol. If you provide both properties, the library considers ticker as the higher priority property.

full_name

A string that has the EXCHANGE:SYMBOL format. This string is displayed on the chart legend. If you do not specify full_name manually, the library generates the property value using name and exchange.

ticker

If you need to address a symbol by a custom identifier (for example, numeric), you can use ticker instead of full_name. This identifier is not displayed to the users. Make sure you provide ticker in LibrarySymbolInfo and SearchSymbolResultItem.

caution

Some Trading Terminal features like Watchlist, Details, and Account Manager does not support ticker, and the library uses full_name to request data for them.

Resolutions

Resolution or time interval is a time period of the single bar. The library supports resolutions in seconds, minutes, hours, days, weeks, months, years, and ticks. To enable any resolution, specify the following properties:

The resolutions should be listed in a specific format. For example, ["1", "15", "240", "D", "6M"] stands for 1 minute, 15 minutes, 4 hours, 1 day, and 6 months. If a certain symbol does not support some chart resolutions, they are disabled in the UI for this symbol.

Supported resolutions

If a user switches to another symbol, that does not support the selected resolution, the library changes the resolution to the first available one for this symbol.

Resolution Data

The library requests data from the datafeed based on the selected resolution. All resolutions that your datafeed explicitly supports should be listed in the *_multipliers properties (seconds_multipliers, daily_multipliers, etc. ) and implemented in the getBars method. You can also enable resolutions that your datafeed does not explicitly provide because the library can combine smaller intervals into larger ones to build new resolutions. For instance, it can build 2-minute bars from 1-minute bars.

caution

The library cannot build daily, weekly, or monthly resolutions using intraday data.

Consider the following example. The datafeed has 1-minute and 2-minute bars. Also, you would like to support a 5-minute resolution. In this case, you should configure the LibrarySymbolInfo properties as follows:

//...
"has_intraday": true,
"supported_resolutions": ["1", "2", "5"],
"intraday_multipliers": ["1", "2"], // The library can request 1-minute and 2-minute bars, and will build 5-minute bars from 1-minute data
//...

The example of getBars implementation is demonstrated below:

getBars(symbolInfo, resolution, periodParams, onHistoryCallback, onErrorCallback) {
if (resolution === '1') {
const bars = getBarsFor1MinuteResolution(periodParams);
onHistoryCallback(bars);

return;
}

if (resolution === '2') {
const bars = getBarsFor2MinuteResolution(periodParams);
onHistoryCallback(bars);

return;
}

//...
}

function getBarsFor1MinuteResolution(periodParams) {
// Your custom logic
}

function getBarsFor2MinuteResolution(periodParams) {
// Your custom logic
}

Resolution in Seconds

To enable resolution in seconds, you should additionally configure the following properties:

Resolution in Minutes (Intraday)

To enable intraday resolution (in minutes), you should additionally configure the following properties:

Resolution in Days

To enable resolution in days, you should additionally configure the following properties:

Resolution in Weeks / Months

To enable resolution in weeks or months, you should additionally configure the following properties:

Resolution in Ticks

To enable resolution in ticks, you should additionally configure the following properties:

Time zone

The library arranges data based on the timezone value. Make sure you specify this property to avoid potential issues. If your time zone is not supported, you can request it on GitHub Issues 🔐 (restricted access).

Session

The library arranges data based on the session value. Make sure you specify this property to avoid potential issues. Refer to the Trading Sessions topic for more information on the session format.

subsession_id

The subsession ID of this symbol. The value of this property should match one of the ids from subsessions. Should usually be 'regular' or 'extended' depending on whether or not the symbol is in extended trading mode.

subsessions

Read more about extended sessions here

An array of objects describing the subsessions of this symbol.

Each object must have the properties id, description, and session:

  • id is a unique identifier for the subsession.
  • description is a description of subsession. For example 'Regular Trading Hours'.
  • session is a session string. See session for more information.
  • 'session-correction' is an optional session correction string.

Price Format

The library supports the decimal and fractional price formats. To configure how the price displays, specify the following properties:

  • pricescale — a number of decimal places or fractions that the price has.
  • minmov — a number of units that represents the price tick.
  • minmove2 — a fraction of a fraction.
  • fractional — a boolean value that shows whether the format is fractional or decimal.

These properties' values depend on the chosen format and are not visible to users.

Decimal Format

  • pricescale should be 10^n, where n is the number of decimal places. For example, if the price is 1.01, set pricescale to 100.
  • minmov depends on the tick size that is calculated as minmov / pricescale. For example, if the tick size is 0.25, set minmov to 25.
  • minmove2 should be 0 or not specified.
  • fractional should be false or not specified.

Consider the following examples:

  • The security's tick size is 0.01. To display this security, set minmov = 1, pricescale = 100.
  • The security's tick size is 0.0125. To display this security, set minmov = 125, pricescale = 10000.
  • The security's tick size is 0.20. To display this security, set minmov = 20, pricescale = 100.

How to Display Pips

You can display pips for symbols that have forex or cfd type. To do this, specify minmovement2 with 10^n value, where n is the number of digits that are displayed as pips. In the UI, pips look smaller than the price digits. For example, set minmovement2 to 10 to display the price as follows:

Symbology Pips Example

If minmovement2 is 0 for forex/cfd symbols, the spread is displayed in ticks, not pips.

Fractional Format

The fractional price is displayed as x'y (for example, 133'21), where x and y are the integer and fractional parts, respectively. A single quote is used as a delimiter.

  • pricescale should be 2^n. This value represents the number of fractions.
  • minmov depends on the tick size that is calculated as minmov / pricescale. For example, if the tick size is 1/4, set minmov to 1.
  • minmove2 should be 0 or not specified.
  • fractional should be true.

Consider the following examples:

  • To display a security that has the 1/32 tick size, set minmov = 1, pricescale = 32.
  • To display a security that has the 2/8 tick size, set minmov = 2, pricescale = 8.

Fraction of a Fraction Format

The fraction of a fraction format is a particular case of the fractional format. It is displayed as x'y'z (for example, 133'21'5), where z is a fractional part of y. In this case, minmove2 differs from 0 and represents a fraction of a fraction. For example, the ZBM2023 tick size is 1/4 of a 32nd. To display this security, set minmov = 1, pricescale = 128, minmove2 = 4. The price is displayed in the UI as follows:

  • 119'16'0 represents 119 + 16.0/32
  • 119'16'2 represents 119 + 16.25/32
  • 119'16'5 represents 119 + 16.5/32
  • 119'16'7 represents 119 + 16.75/32