# Sway Charts Pro User-Defined Indicators

- [Introduction](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction.md)
- [1.1 Access to the Sway Charts scripting framework (UDI vs UDIX)](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction/1.1-access-to-the-sway-charts-scripting-framework-udi-vs-udix.md)
- [1.2	Example UDI code](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction/1.2-example-udi-code.md)
- [1.3	Adding a UDI to a chart](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction/1.3-adding-a-udi-to-a-chart.md)
- [1.4	Lifecycle](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction/1.4-lifecycle.md)
- [1.5	Alerts](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction/1.5-alerts.md)
- [1.6	Indicator-on-indicator](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction/1.6-indicator-on-indicator.md)
- [1.7	Technical note: web workers](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction/1.7-technical-note-web-workers.md)
- [1.8	Technical note: dates](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/introduction/1.8-technical-note-dates.md)
- [Initialisation: UDI.onInit()](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/initialisation-udi.oninit.md)
- [2.1	Return value from UDI.onInit()](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/initialisation-udi.oninit/2.1-return-value-from-udi.oninit.md)
- [2.2	The plots\[\] array](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/initialisation-udi.oninit/2.2-the-plots-array.md)
- [2.3	The settingsFields\[\] array](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/initialisation-udi.oninit/2.3-the-settingsfields-array.md)
- [2.4	Context data passed to UDI.onInit()](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)
- [Calculating data: UDI.onCalculate()](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/calculating-data-udi.oncalculate.md)
- [3.1	Reading settings fields](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/calculating-data-udi.oncalculate/3.1-reading-settings-fields.md)
- [3.2	Input data for the UDI](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/calculating-data-udi.oncalculate/3.2-input-data-for-the-udi.md)
- [3.3	Updates of the current bar only](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/calculating-data-udi.oncalculate/3.3-updates-of-the-current-bar-only.md)
- [3.4	Calculating output data](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/calculating-data-udi.oncalculate/3.4-calculating-output-data.md)
- [3.5	Requesting out-of-band updates](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/calculating-data-udi.oncalculate/3.5-requesting-out-of-band-updates.md)
- [3.6	Technical analysis: moving averages, ATR etc](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/calculating-data-udi.oncalculate/3.6-technical-analysis-moving-averages-atr-etc.md)
- [Changes to the chart or parameters](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/changes-to-the-chart-or-parameters.md)
- [4.1 UDI.onContextChange()](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/changes-to-the-chart-or-parameters/4.1-udi.oncontextchange.md)
- [4.2	UDI.onParameterChange()](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/changes-to-the-chart-or-parameters/4.2-udi.onparameterchange.md)
- [Creating drawings, event markers, and bar highlights](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/creating-drawings-event-markers-and-bar-highlights.md)
- [5.1	Creating drawings](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/creating-drawings-event-markers-and-bar-highlights/5.1-creating-drawings.md)
- [5.1.1 Drawing properties](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/creating-drawings-event-markers-and-bar-highlights/5.1.1-drawing-properties.md)
- [5.2	Creating event markers](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/creating-drawings-event-markers-and-bar-highlights/5.2-creating-event-markers.md)
- [5.2.1	Click notifications from event markers](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/creating-drawings-event-markers-and-bar-highlights/5.2.1-click-notifications-from-event-markers.md)
- [5.3	Creating bar highlights](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/creating-drawings-event-markers-and-bar-highlights/5.3-creating-bar-highlights.md)
- [Notifying the user](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/notifying-the-user.md)
- [6.1	Creating toast](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/notifying-the-user/6.1-creating-toast.md)
- [6.2	Changing the panel background colour](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/notifying-the-user/6.2-changing-the-panel-background-colour.md)
- [Adding HTML to the chart](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/adding-html-to-the-chart.md)
- [7.1	Adding HTML](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/adding-html-to-the-chart/7.1-adding-html.md)
- [7.2 Positioning the HTML](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/adding-html-to-the-chart/7.2-positioning-the-html.md)
- [7.3	Sending messages from the HTML to the UDI](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/adding-html-to-the-chart/7.3-sending-messages-from-the-html-to-the-udi.md)
- [7.4	Sending messages from the UDI to the HTML](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/adding-html-to-the-chart/7.4-sending-messages-from-the-udi-to-the-html.md)
- [Recommended trade](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/recommended-trade.md)
- [8.0 Recommended trade](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/recommended-trade/8.0-recommended-trade.md)
- [Other indicator topics](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/other-indicator-topics.md)
- [9.1	Collecting external data](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/other-indicator-topics/9.1-collecting-external-data.md)
- [9.2	Converting dates to chart time](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/other-indicator-topics/9.2-converting-dates-to-chart-time.md)
- [9.3	Multi-timeframe (MTF) indicators](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/other-indicator-topics/9.3-multi-timeframe-mtf-indicators.md)


---

# 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.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.
