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"); sets up the identifier "TREND:L" for the current algorithm for long trades. Short trades are suppressed.

Remarks:

Example:

algo("TREND:L"); // algorithm identifier for a trend trading algorithm with long trades
...
if(short_condition) 
  enterShort(ifelse(strstr(Algo,":L"),0,Lots)); // suppress short trades when Algo ends with ":L"

See also:

enterLong, enterShort, loop, string, asset, Algo, AlgoVar, TradeAlgo

► latest version online