You can use pre-defined (built-in) functions in your source code. These functions either calculate a result that you can then use in your own program or draw results on the screen as study objects. To use a function, you have to call it from within your own program: See Function Call for more details on the correct syntax.

In this section, you will find descriptions of the functions that are included within the TeleTrader Language. Those are:

Drawing Functions

These functions draw and remove lines, areas and markers on the screen

Mathematical Functions

These functions represent some basic mathematical functions, like exponential or trigonometric functions

Date / Time Functions

These functions allow you to access the current system date and time or the date and time of the bar / data point that is currently active

System Functions

These functions perform some basic operations or calculations that are frequently needed regarding the time series (security) that the program is executed for

Text Functions

These functions can be used to manipulate text (strings).

For each function, the syntax is explained including the input values (parameters) that have to be passed to the function and the output that the function generates.

General information about input types and automatic conversions

Whenever you pass an input value (parameter) to a function, you have to take care that the list of parameters you supply matches the type of parameters that are needed by the function – if the function needs a numeric input, you cannot call it up with a text input, for example. In some cases however, values are automatically converted to an appropriate type.

Function expects…

Remarks

Numeric

The input value must be a constant number, a variable or parameter of the type Numeric, Numeric Field or Security, the numeric result of a function call or a numeric expression.

When using a parameter of the type Numeric Field (e.g. Source), it is automatically converted to the single numeric value Source[0]. You can of course also explicitly use historic values (e.g. Source[1]).

When using a parameter of the type Security (e.g. Security), it is automatically converted to the single numeric value Security[0].Close. You can use historic values or other field elements (Open, High etc.) by stating them explicitly.

Numeric Field

The input value must be a parameter of the type Numeric Field or Security.

When using a parameter of the type Security (e.g. Source), it is automatically converted to use the field element Source.Close except when stated otherwise.

It is important to understand that the values of a parameter of the type Numeric Field are equal to the corresponding field elements of a Security parameter for the same base. For example, when you have defined a Numeric Field parameter named source1 and a Security parameter named source2, you could both use source1 or source2.Close as the input for a function. The only difference is that when using a Security parameter, you have to explicitly state in the source code which value (Close, Open etc.) you want to use, while when using a Numeric Field parameter, you can later change the value that is used in the Insert Study dialog, which is often the more flexible approach.

In some situations, you can also use a Numeric variable in a place where Numeric Field is expected: If history is available for the variable, the variable will automatically be converted to the type Numeric Field. This also applies to numeric results of a function call and numeric expressions: For example, you can write Sum(Sum(source1, period1),period2) or Sum(source.Open -source.Close, period).

Security

The input value must be a parameter of the type Security.

Boolean

The input value must be the reserved word True or False, a variable or parameter of the type Boolean, the Boolean result of a function call or a Boolean expression.

Text

The input value must be a text enclosed in quotes, or a variable or parameter of the type Text.

Erfahren Sie mehr:

Drawing Functions

Mathematical Functions

Date / Time Functions

System Functions

Text Functions