Script Validation

A script may optionally contain a validate function.  The validate function is executed before the Calculate function, and before the user is allowed to accept their parameters.  The validate function has access to the script primary input series, the parameters, and the Output just like the calculate function, so validation can be performed on the basis of the content of a data series.

If the Validate function must either return nothing (an "undefined" JavaScript object) or a string indicating why the parameters are not valid.  If a string is returned the parameters are invalid and the string is displayed to the user.

If the Validate function is not present, the script parameters selected by the user are assumed to be valid.