Formula syntax and structure
An MM-Talk formula is a combination of functions, variables and constants which, when applied to an object, produces a result object.
The simplest form of an MM-Talk formula is a simple function without variables. This allows you to query attributes of an input object, for example. The most important input objects for formulas are securities account objects and securities. A complete list of all MM-Talk functions can be found at MM-Talk reference.
To query a close price, for example, the "Close" function is applied to a security, i.e. a security is the input object for this function. The resulting object is a time series that reflects the close history of this security.
You can link MM-Talk functions together in almost any way you like. In the example above, a property of an object was queried. You can apply another function to the result of this query.
Only the property notation is used in this chapter, but you can also use the functional notation. There are also function abbreviations for some functions. More on this in the chapter Spellings.
Beispiel: GD eines Wertpapiers berechnen
It is important that you always follow the logical sequence: The most general query is at the beginning, more specific queries are placed afterwards: First you select the security, then a price trend, and finally you select the analysis method.
- Which security is to be analyzed?
The input object (here the security) does not usually have to be explicitly named, as it is generally already defined by the evaluation framework (e.g. in charts, the displayed security is always the input object). - Which price trend serves as the basis for the analysis?
The close trend is to be analyzed here; the corresponding function is"Close". - Which analysis method should be used?
The analysis method is the moving average, the term for this is"GD". The expression"GD" is applied to the expression"Close" by writing both one after the other separated only by a dot (without spaces). The finished formula is therefore "Close.GD".
This formula generates a price time series, i.e. a value progression. If only a single price from a time series is required (e.g. for a table entry), you can query this with the corresponding function.
To determine the GD of a security on a specific date, apply the function"AT[$date;$period]" to the formula"Close.GD" , which can be used to specify the date. The finished formula is:CODEClose.GD.AT[$Datum;$Zeitraum]
In this example, variables, namely"$date" and"$period", were used. You can find out more in the following section Assignment of parameters.