> 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/calculating-data-udi.oncalculate/3.1-reading-settings-fields.md).

# 3.1	Reading settings fields

Your UDI can have settings fields, such as the number of bars for a moving average, and the current value of each of these settings is then available in the data.parameters which are passed to UDI.onCalculate().&#x20;

Within data.parameters there will be a property for each settings field, using the id you defined in the settingsFields\[] array, and the value of the property is the field's current value.

For example:

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

…

UDI.onCalculate = function(data, output)
{
	// Get the user-selected value of the "period" parameter
	var period = data.parameters["period"];   // Can also use  data.parameters.period
	…
}
```
