> For the complete documentation index, see [llms.txt](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](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).

# 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"];
	…
}
```
