Skip to main content
Version: latest

Symbology

The library requires information about the symbol 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 ticker or name to specify such an identifier for a certain symbol.

info

The ticker or name should not contain information other than an identifier for a symbol. Therefore, they should not contain the exchange.

name

The name property is an identifier for a symbol within an exchange, such as AAPL or 9988 (on Hong Kong exchange). This identifier is visible to users. Note that the name value does not have to be unique and can be duplicated for several symbols.

By default, name is used to resolve symbols in the Datafeed API. If you use ticker, the library will use the ticker for Datafeed API requests.

ticker

If you need to address a symbol by a custom identifier (for example, numeric), you can use ticker. This identifier should be unique. It is not displayed to users.

If you provide ticker, the library will use it for Datafeed API requests. Make sure you provide ticker in LibrarySymbolInfo and SearchSymbolResultItem.

Resolutions

Refer to the Resolution article for information on how to specify the following properties:

Time zone

The timezone property should contain a time zone of the symbol's exchange. For example, if the symbol's exchange is NASDAQ, the timezone value should be "America/New_York".

The timezone value affects how the library arranges data on the chart. Make sure you specify this property correctly to avoid potential issues, such as shifted bars. For more information about supported time zones, refer to the Time zones article.

Session

The session property contains trading hours for the symbol. The time zone of the trading hours corresponds to the timezone value.

The session value affects how the library arranges data on the chart. Make sure you specify this property correctly to avoid potential issues, such as shifted bars. Refer to the Trading Sessions topic for more information on the session format.

corrections

The corrections property allows you to specify changes in a trading session for a specific day. For example, you can extend or shorten the session or reschedule it for another day. The corrections value overrides the default session specified in the session property. You can specify corrections for days in the past and future.

The correction is a string that has the SESSION:YYYYMMDD format and consists of the following elements:

ElementDescriptionExample
SESSIONTrading hours specified in the same format as the session property. Refer to Session formats for more information.10:0014:00
:A separator between the session and the day when it is applied.
YYYYMMDDA day when the session is applied.20181114

If the correction is applied to multiple days, you should list the days starting from the latest one and separate them by comma. For example, "1000-1400:20180308,20180223,20180101". To specify several corrections, list them one by one and use a semicolon as a separator, for example, "1000-1845:20181113;1000-1400:20181114".

You can also specify corrections for holidays. Note that the corrections property has higher priority than session_holidays. Therefore, if both properties contain the same date, the library applies hours specified in corrections for that date.

Extended sessions

The library allows you to display extended trading sessions for symbols that support them. To enable an extended session for a certain symbol, you should specify the properties below. For more information on how to handle the sessions, refer to the dedicated Extended sessions article.

subsessions

An extended session includes regular, pre-market, and post-market subsessions. Either a pre-market or post-market subsession can be missed. When the chart displays an extended session, the subsessions are represented as colored areas.

You should provide information on the extended session and its subsessions to the library using the subsessions property. The property contains an array of LibrarySubsessionInfo objects, where each object describes a certain subsession. For example, the code sample below specifies an extended session that starts at 04:00 and ends at 20:00. It includes a pre-market subsession from 04:00 to 09:30, a regular subsession from 09:30 to 16:00, and a post-market subsession from 16:00 to 20:00.

"subsessions": [
{
"description": "Regular Trading Hours",
"id": "regular",
"session": "0930-1600"
},
{
"description": "Extended Trading Hours",
"id": "extended",
"session": "0400-2000"
},
{
"description": "Pre-market",
"id": "premarket",
"session": "0400-0930"
},
{
"description": "Post-market",
"id": "postmarket",
"session": "1600-2000"
}
]

subsession_id

The subsession_id property specifies the session type that the chart should currently display. The subsession_id value is either "regular" or "extended".

Supported price values

The visible_plots_set property indicates which values the symbol supports, such as open, high, low, close, and volume. If you prefer to only provide close values, set visible_plots_set to "c". This makes the chart show the symbol data using only line-based styles.

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.

Variable tick size

If you need to adjust a tick size depending on a symbol price, you can additionally specify the variable_tick_size property. This property should be a string that contains prices and the corresponding tick sizes. The library overrides the pricescale and minmov properties to represent the desired tick size.

For example, the '0.01 10 0.02 25 0.05' value specifies the following ticks:

  • For prices less than or equal to 10, the tick size is 0.01. Therefore, minmov = 1, pricescale = 100.
  • For prices greater than 10 but less than or equal to 25, the tick size is 0.02. Therefore, minmov = 2, pricescale = 100.
  • For prices greater than 25, the tick size is 0.05. Therefore, minmov = 5, pricescale = 100.

Note that you need to initialize pricescale and minmov regardless of whether you use variable_tick_size or not.

How to display pips

You can display pips for symbols that have forex or cfd type. To do this, set minmove2 to 10. In the UI, pips look smaller than the price digits.

Symbology Pips Example

If minmove2 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