Skip to main content
Skip table of contents

Application examples for time series

In this section you will find some typical examples of working with course time series. Further examples of the practical application of the MM-Talk formula language can be found in the user manual.

Query of different value curves

All time series can provide several value curves. This also applies to time series formed by arithmetic functions. If no other course is explicitly requested, the course history supplied as standard will be used.

For example, the"Close.GD" formula generates the moving average of the close progression, as the"Close" function provides the close consolidation by default.

However, a time series can also provide any other non-standard price trend. A typical application example is a candlestick chart for which the consolidation types close, open, high and low are requested one after the other.

All purely arithmetic functions (such as the"GD"function) simply pass on the request for a special progression to their predecessor functions. In the"Close.GD" example, the requested consolidation type would be queried from the price time series delivered by the"Close" function.

In the same way, the formula"Close.GD.DMI" can be used to calculate a DMI that does not operate directly on the prices, but on the average prices. And accordingly, a candlestick chart can be generated with the"cash" formula, which is formed (in the case of weekly presentation) via the weekly consolidation of the cash series.

A special MM-Talk function is used to query the price trend:

LineTypeGet

TimeSeries.LineTypeGet[Type;ConsolidationType]

Result typeParametersResult
Time series

Type (line type [Default])
The following line types are available: Price, Spot, Volume, Contract, OpenInterest and Default.

Consolidation (consolidation type [Default])
The following consolidation types are available: Open, High, Low, Close, Sum, Average, Count and Default.

The function returns the time series that contains the line of the predecessor given by <type>, <consolidation> as the main line.
Multiline time series

The following MM-Talk function is available for creating a multi-line time series:

LinesMulti

LinesMulti[Line1;Line2;Line3;Line4;Line5;Line6;Line7;Line8;Line9]

Result typeParametersResult
Time series

Line1...Line9 (time series).

This function generates a multiline time series from the (default) progressions of up to 9 time series.

The following MM-Talk function is used to access individual time series in a multiline time series:

LineGet

TimeSeries.LineGet[Line]

Result typeParametersResult
Time series

Line (Number|String [0]): The number of the multiline (0=main line,1...4), or the name of the line (cf. LineNames).

The function returns the time series that contains the line of the predecessor given by <Line> ("line identifier") as the main time series, which is a multiline time series.

You can find more information on multiline time series in the chapter Time series objects.

If queries

If queries play an important role when working with time series. They have the form:

If(Condition: Time series; Then-case: Time series or number; Else case: Time series or number)→Time series

The result of the If functionis a time series that returns the same time value of the Then case for each value of the condition time series that is different from zero, and otherwise the same time value of the Else case. If Then or Else cases are not time series but numbers, the same number is always used.

The formula"If(Close>Close.Before[1]];Close;0)" , for example, returns a time series that (by default) contains the close price for all days on which it is greater than in the previous period; otherwise the value is 0.

In this formula, the close history is accessed three times, i.e. the value is queried three times in the database. As database queries are time-consuming, it makes more sense to assign the Close value to a variable beforehand; then only one database call is necessary.
$Close:=Close;
If($Close>$Close.Before[1];$Close;0)
You can find out more about this in the Sub-expressionssection.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.