Skip to main content
Skip table of contents

Formulas for trading systems

Module "Advanced Technical Analysis"

Trading systems are representations of technical trading rules that can be analyzed currently (new trading signals) or historically.

In the Infront Portfolio Manager, trading systems have the following components:

  • Line(s): a line (or several lines as a multiline time series), which are optionally displayed in the chart together with auxiliary lines for the trading system. For example, it makes sense to display the RSI line in the chart if the trading system is based on an RSI indicator.

Specification of four signal sequences

  • Long signals: Buy signals
  • Short signals: (Short) sell signals, i.e. based on short signals, any long positions are closed and at the same time a short position is opened (the security is sold short).
  • Close-long signals: Signal to end a long phase, but without opening the opposite position at the same time.
  • Close-short signals: Signal to end a short phase, but without opening a long position at the same time.

For signal interpretation and performance evaluation

  • Spesensatz: Fee deduction (percentage) per trading transaction for performance evaluation.
  • Include/exclude short sales: Switch to ignore short signals.
  • Limit: This parameter places an additional limit strategy over the indicator signals, i.e. the trading phases are terminated prematurely when a loss limit is reached. If this limit is specified as a percentage, it is understood as a trailing loss, i.e. the loss is based on the price optimum since entry. Instead of a percentage rate, this parameter can also be used to specify a freely definable rule for the termination of trading phases in the form of an MM-Talk function.
  • Interest rate: This parameter is used to simulate a return on capital at times when the trading system is not invested.
  • Courses: If prices other than close prices are to be used for the entry and exit prices of trading systems, this parameter can be used to transfer a time series for the price determinations. Variants would be to extract the open prices or average values such as the typical price.
  • Delay (signal delay): Defines when a simulated trade is to take place based on a signal, i.e. after how many periods (in relation to the trading price time series) a reaction to a signal takes place. The default value here is 1, i.e. trading takes place by default on the close of the following day.
  • Slippage: Slippage is the difference between the prices that trigger a trading signal and the less favorable prices that are actually achieved when trading. This effect can be simulated using a percentage that adjusts the trading prices to the disadvantage of the trader.

In MM-Talk formulas, trading systems are defined by the operator TradingSystem operator. The display line, the signal specification and parameters for signal interpretation and performance evaluation must be specified as parameters.

TradingSystem[
$Lines; {display lines, if necessary with auxiliary lines}
$Long;
$Short;
$CloseLong;
$CloseShort; {up to four signal time series}
$SignalMode; {mode of signal generation: 1,2 or 4}
$Include_short_sales; {ignore_short_phases: True/False}
$Costs; {trading rate}
$Limit {additional limit strategy}
$Interest {interest rate}
$Prices {time series of trading prices}
$Delay {signal delay}
$Slippage {trading price reduction}
]

There are four different modes of signal specification: through one, two or four signal time series or a state time series. For signal time series, time series that provide truth values ("True"/"False") are always used.

Only one signal time series (mode 1)

Only long and short signals are generated in this mode. The signal time series is not used to display the signal points directly, but should provide the value "True" at all points in time at which you want to hold a long position. Long signals are thus generated at the points at which the time series changes from "false" to "true", short signals when it jumps from "true" to "false".

Beispiel (Modus 1)

TradingSystem[
Close.Mom ; {display momentum of the close}
Close.Mom>100 ; {signal time series}
_;_;_; {leave remaining time series fields empty}
1 {interpretation of the signal line(s): a line as a status signal series}
]

The trading system provides a long signal when the momentum (parameter omitted for the sake of brevity) crosses the 100 line from bottom to top and a short signal when the momentum falls back to or below 100.

Two signal time series (mode 2)

Here, the signal time series are interpreted in a similar way to a signal time series, but separated by two time series for long and short phases. The first signal time series defines the interplay between long and close-long signals and the second between short and close-short signals.

Beispiel (Modus 2)

$Line:= Close.RSI;

Trading system[
$Linie.HL[30;70]; {display: RSI line with auxiliary lines at 30 and 70}
$line>30; {Long: Comparison with 30 line}
$line<70; {Short: Comparison with 70 line}
_;_; {leave remaining two time series blank}
2 {two-lines mode}
]

The trading system provides long signals when the RSI on Close breaks through the 30 line from bottom to top and close long signals when it falls below the 30 line again. The same applies to short signals and the 70 line.

Four signal time series (mode 4)

In this mode, the signal time series should deliver the value "True" exactly at the points in time at which a signal is to be fired. There is a signal time series for each of the four signal types.

Beispiel (Modus 4)

$line:= Close.RSI;
Trading system[
$line.HL[30;70]; {display: RSI line with auxiliary lines at 30 and 70}
$Line.Breaks[30]; {Long: Comparison with 30 line}
$Line.Breaks[30;true];
$Line.Breaks[70;true]; {Short: Comparison with 70 line}
$Line.Breaks[70];
4 {Four -line mode}
]

The trading system provides the same signals as the system with two signal time series, but here the conditions for all four signal types are made explicit.

In the case of trading systems with two and four signal time series, not all 2 or 4 signal time series must necessarily be specified. If, for example, you set the short time series and the close-short time series to default ('_') in mode 4, no short or close-short signals are generated for the trading system.

One state time series (mode 0)

A state time series does not contain any truth values, but the trading system state (long, short or out) is specified directly in the form of 0= out, <0 = short, >0 = long).

Beispiel (Modus 0)

$Line:= Close;

$State:=Close.OptimalTradeSystemState[$StartDate;
$Costs; $Slippage; $Interest]

Trading system[
$line;
$state; {pass state}
_;_;_; {leave other time series empty}
0 {state mode}
true;$charges;$interest;close;0;$slippage]

JavaScript errors detected

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

If this problem persists, please contact our support.