Investment Studio > Expressions > Functions

Functions take input values (arguments) and compute a result (which may be an array containing multiple values). Arguments are sandwiched between parentheses and separated by the list separator character.

The list separator character depends on the computer's regional settings. It's typically a comma (,) or a semicolon (;). In this document, a comma is used.

The identifier preceding the opening parenthesis is the function name. Even if a function takes no input values, the function name must be immediately followed by a pair of parentheses. Otherwise, it will be interpreted not as function name but as a constant or symbol.

Example:

=PI()

returns the value of the built-in function PI, while

=PI

returns the value of the built-in constant PI.

Like all built-in identifiers, the names of built-in functions are not case sensitive.
Example:

=PI()

=Pi()

=pi()

are all equivalent.

When an expression is parsed, any identifier immediately followed by an opening parenthesis is interpreted as a function name. If there is no matching built-in function, the name is assumed to be that of a macro function, and is passed on to the connected ActiveX Scripting engine (if any).

Note that some ActiveX Scripting engines (e.g. JScript, but not VBScript) are case sensitive. If you use such an engine, macro names will be case sensitive, i.e. =my_function() will not be equivalent to =MY_FUNCTION(). Macro function names are always passed as typed, unmodified, to the engine.

Many functions have default argument values, which are used if the corresponding actual arguments are omitted.

Example:

=fixed(PI)

=fixed(PI, 2)

=fixed(PI, 2, FALSE)

are all equivalent, since the function fixed is defined as

string fixed(float value, integer digits = 2, boolean no_commas = FALSE)

meaning that the second argument (digits) has the default value 2 and the third argument (no_commas) has the default value FALSE.

Note however that

=fixed(PI, , FALSE)

is not a legal expression. Unless otherwise stated in the function's documentation, empty argument "slots" are not allowed.

The built-in functions can be broadly classified by use:

Math & Trig Elementary arithmetic and trigonometric functions.
Lookup Used to access portfolio, asset and transaction properties (see lookup data types)
Indicator Technical Analysis of price time series.
Date & Time Manipulation and computation of dates, times and time differences.
Text String manipulation.
Matrix Operations on arrays (including basic matrix operations, sorting and equation solving).
Reference Used to access values stored in other cells and/or in arrays.
DSP Digital Signal Processing functions, mainly for the creation and application of filters. Also useful for Technical Analysis.
Financial Common business calculations like the present value of a bond or the future value of an investment.
Statistical Standard functions for the statistical analysis of data. Also useful for Technical Analysis.

If you want to know more about a specific function and you already know its name, you can also look it up in the alphabetic list.