Custom Functions

Custom function is a procedure or a function that calculates or transforms data by custom algorithm.

All custom functions are global within the repository and are available for use in all time series databases in the desktop and web applications.

Creating Custom Functions

To create a custom function, use the IForeMethods.Add.

On creating a custom function consider the value of the Type parameter to determine method type (arithmetic, pointwise or series). If the custom function is of series type, it handles all selected series simultaneously. One output series containing calculation results is added to the workbook. On specifying parameters of a custom function in the Parameters for dialog box the Result series corresponding to the output series is available.

NOTE. Custom functions can be created only in the desktop application.

In the child-modeling container, custom functions are always calculated in the series mode. All parameters specified in the Parameters For dialog box are recognized automatically. If data series are used in calculation, the data series type should be of the ITimeSeries type. To return calculated values of the function the data of the ITimeSeries type should also be used.

Example

Sub MyFunc(Input: ITimeSeries; Output: ITimeSeries; Coef: Double);

Function MyFunc1(Input, Input1: ITimeSeries; Coef: Double): ITimeSeries;

If the custom method is arithmetic or pointwise, the function that returns the data of the ITimeSeries type should be used as the custom method.

On calculating method for several series the calculation is performed for each series individually. The series with results for each calculated series is added to the workbook.

Applying Custom Functions

Use items on the Calculations ribbon tab to apply custom calculation function to the time series. Item location depends on method settings:

If method calculation requires some additional parameters to be entered, the Parameters For dialog box opens.

After applying the custom function a series with named <Method_name>(<Explanatory_Series_List>) type, containing calculation results is added to the workbook.

See also:

Working with Calculated Series | Setting Up Calculation Method Parameters