# 4.2	UDI.onParameterChange()

UDI.onParameterChange() is called whenever there is a change to the user-defined settings for your UDI. The function receives a data parameter which contains the new settings, as a parameters object. It also receives the same context information which is passed to UDI.onInit(), in data.context.

For example:

```
settingsFields: [
	// Number of bars for the average 
	{id: "period", caption: "Period", type: "int", defaultValue: 14, min: 2}
]

UDI.onParameterChange = function(data)

{
	// Get the latest user-selected value of the "period" parameter
	var period = data.parameters["period"];
	…
}
```


---

# 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/changes-to-the-chart-or-parameters/4.2-udi.onparameterchange.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.
