algo (string name): int

Sets the algorithm identifier for identifying trades. Using algorithm identifiers is recommended in portfolio strategies that contain different trade algorithms; they are used to create separate strategy parameters, rules, and capital allocation factors per algorithm.

Parameters:

name

The algorithm identifier (max. 15 characters, no spaces). If name ends with ":L", the algo is for long trades only; if it ends with ":S" the algo is for short trades only.

Returns:

0 when the name string is NULL or empty, otherwise nonzero.

Usage:

algo("TREND:L"); defines the identifier "TREND:L" for the current algorithm for long trades.

Remarks:

If different algorithms or parameters for long and short trades are used, the identifiers should end with ":L" or ":S" for being consistent with the trade names used in the message window and parameter files. Long trades should be suppressed by script on ":S" algos and vice versa.

The algorithm identifier is stored in the Algo string variable, and can be evaluated in strategies with the strstr function.

Any algo/asset combination is a component in a portfolio strategy. The performance report lists strategy results separated by components. The Component variable is the number of the current component, starting with 0, and can be used as an array index.