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:

  • The assetList (if any) and an asset must be selected before calling algo().
  • For getting separate factors, parameters, or rules for long and short trades, call the same algorithm with two algo identifiers that end with ":L" and ":S", like the trade names in the message window and parameter files. Long trades are then automatically suppressed on ":S" algos and short trades on ":L" algos, but reverse positions are still closed depending on Hedge. Don't use ":L" or ":S" for symmetric strategies with the same factors, parameters, or rules for long and short trades, or for strategies that trade only long or only short.
  • The algorithm identifier is stored in the Algo string variable, and can be evaluated in strategies with the strstr function.
  • Every algo call switches the trade statistics parameters and the OptimalF factors to the current statistics and factors of the selected algorithm identifier.
  • 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.
  • Algorithm specific data can be stored in the AlgoVar variables.
  • For training algo dependent parameters separately, switch algos in a loop.

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

algo (string name): int

Setzt den Algorithmus-Identifier zur Identifizierung von Trades. Die Verwendung von Algorithmus-Identifikatoren wird in Portfoliostrategien empfohlen, die verschiedene Handelsalgorithmen enthalten; sie werden verwendet, um separate Strategieparameter, Regeln und Kapitalallokationsfaktoren pro Algorithmus zu erstellen.

Parameter:

name Der Algorithmus-Identifier (max. 15 Zeichen, keine Leerzeichen). Wenn name mit ":L" endet, ist der Algo nur für Long-Trades; endet er mit ":S", ist der Algo nur für Short-Trades.

Rückgabewerte:

0 wenn der name String NULL oder leer ist, ansonsten ungleich Null.

Verwendung:

algo("TREND:L"); setzt den Identifier "TREND:L" für den aktuellen Algorithmus für Long-Trades. Short-Trades werden unterdrückt.

Bemerkungen:

  • Die assetList (falls vorhanden) und ein asset müssen ausgewählt sein, bevor algo() aufgerufen wird.
  • Um separate Faktoren, Parameter oder Regeln für Long- und Short-Trades zu erhalten, rufen Sie denselben Algorithmus mit zwei Algo-Identifikatoren auf, die mit ":L" und ":S" enden, ähnlich den Handelsnamen im Nachrichtenfenster und den Parameterdateien. Long-Trades werden dann automatisch bei ":S" Algorithmen unterdrückt und Short-Trades bei ":L" Algorithmen, aber umgekehrte Positionen werden je nach Hedge weiterhin geschlossen. Verwenden Sie ":L" oder ":S" nicht für symmetrische Strategien mit denselben Faktoren, Parametern oder Regeln für Long- und Short-Trades oder für Strategien, die nur Long oder nur Short handeln.
  • Der Algorithmus-Identifier wird in der Algo Zeichenkettenvariablen gespeichert und kann in Strategien mit der strstr Funktion ausgewertet werden.
  • Jeder algo Aufruf wechselt die Handelsstatistik-Parameter und die OptimalF Faktoren zu den aktuellen Statistiken und Faktoren des ausgewählten Algorithmus-Identifiers.
  • Jede Algo/Asset Kombination ist eine Komponente in einer Portfoliostrategie. Der Performance-Bericht listet die Strategieergebnisse nach Komponenten auf. Die Variable Component ist die Nummer der aktuellen Komponente, beginnend mit 0, und kann als Array-Index verwendet werden.
  • Algorithmen-spezifische Daten können in den AlgoVar Variablen gespeichert werden.
  • Um Training Algo-abhängige Parameter separat zu trainieren, wechseln Sie Algorithmen in einer Schleife.

Beispiel:

algo("TREND:L"); // Algorithmus-Identifier für einen Trend-Handelsalgorithmus mit Long-Trades
...
if(short_condition) 
  enterShort(ifelse(strstr(Algo,":L"),0,Lots)); // unterdrückt Short-Trades, wenn Algo mit ":L" endet

Siehe auch:

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

► neueste Version online