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().

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

}

Last updated