Infront Portfolio Manager

Structure of a complex formula

You can combine MM-Talk functions as required to create longer formulas. You can also make several variable assignments in a formula; the individual assignments must then be separated from each other by semicolons.

$Variable1 :=Expression1;
...
$Variables :=Expressionn;
Result expression

The variable assignment must be at the beginning of the formula. Once a variable has been assigned, it can be used as often as required in any expression of a formula.

The following example, in which a formula is created to calculate a price difference from the previous day, shows you step by step how to create a complex formula:

  1. The input object is a security. First, the current close time series is queried and stored in the variable "$Close":

    $Close:=Close;
    


  2. The same procedure is used for the close time series from the previous day; the result is assigned to the variable "$Close1".

    $Close1:=$Close.Before[1];
    
    
    


  3. Finally, the difference between the two time series is calculated. The result is also a time series:


    $Close-$Close1
    


  4. The finished formula is:

    $Close:=Close;
    $Close1:=$Close.Before[1];
    $Close-$Close1
    


By using the variables cleverly, you save one access to the close time series for each call of the formula in this example.