2.4 Context data passed to UDI.onInit()

The UDI.onInit() function receives one parameter, data, which contains a single member, context, describing the current settings for the chart as a whole.

The same context data is also passed to all other UDI functions, including UDI.onCalculate().

The properties in data.context are as follows:

Property

Description

chartInstanceId

Temporary ID for the chart, not persisting across sessions

chartStyle

Descriptor for the type of chart: filled candle, hollow candle etc

indicatorId

ID allocated to the instance of your UDI on the chart, persisting across sessions and reloads of the chart

userId

Unique but anonymised ID for the logged-in user of the charting system

instrument

Description of the selected instrument and timeframe of the chart, containing the following properties.

instrument.symbol

ID for the selected market

instrument.symbolCaption

Display name for the selected market

instrument.timeframe

Timeframe of the chart, as either a number of seconds (e.g. 3600 for H1), or a negative value for a tick-chart (e.g. -30 for a T30 chart)

instrument.pipSize

"Pip" size of the market, e.g. 0.0001 on EUR/USD

instrument.multiplier

Multiplier applied to the chart prices, e.g. 10

instrument.invertPrices

Whether the user has selected to invert the chart prices

instrument.bid

Current bid price

instrument.ask

Current ask price

timezone

Object describing the user-selected time zone for the chart, with the following properties.

timezone.offset

Base number of minutes ahead of UTC (e.g. 120 for UTC+2)

timezone.dstMode

Daylight savings schedule: 0 = none; 1 = USA; 2 = Europe; 3 = Australia

isUDIX

Whether the UDI has been loaded with Framework access

Last updated