# 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().&#x20;

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                                                                                     |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/initialisation-udi.oninit/2.4-context-data-passed-to-udi.oninit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
