AlgoVar[0] .. AlgoVar[7], AlgoVar2[0] .. AlgoVar2[7]

16 general purpose variables for storing values specific to the current asset/algo combination. Every strategy component has its own set of AlgoVar variables; the sets are automatically switched with any algo or asset call. The variables are stored in STATUS structs and can be used in portfolio strategies for values that are common to the algorithm, but different for every component of the strategy. They can also be used to pass asset/algorithm specific parameters to a TMF, or for storing parameters when a system is stopped and restarted.
 

AssetVar[0] .. AssetVar[15]

AssetStr[0] .. AssetStr[15]

16 general purpose locations for storing either numeric values, or strings specific to the current asset. Every asset has its own set of AssetVar/AssetStr variables; the sets are automatically switched with any asset call. The locations are shared, i.e. either AssetVar[N] or AssetStr[N] can be used, but not both with the same index N. The first 8 variables or strings can be read at start from the asset list and stored in the ASSET structs. They can be used in portfolio strategies for parameters that are common to the algorithms, but different for every asset. AssetStr can only be modified with strcpy and has a maximum length of 7 characters. Use double quotes for strings in the asset list for distinguishing them from numbers.

Type:

var, char* 

AssetInt[0] .. AssetInt[31]

AssetFloat[0] .. AssetFloat[31]

32 general purpose int or float variables specific to the current asset, as above. They are shared with AssetVar/AssetStr at twice the index, i.e. AssetVar[N] is shared with AssetInt[2*N] and AssetInt[2*N+1].

Type:

int, float
 

AssetO, AssetH, AssetL, AssetC, AssetP

Arrays of size NumBars in ascending order (no series), containing the open, high, low, close, and mean prices of the current asset for direct access. AssetC[Bar] is the current close price. In portfolio strategies with assets of different history lengths, not all elements of the arrays are filled. Unfilled elements are zero.

Type:

var*
   

Remarks:

Examples:

// in the run function
...
algo("XYZ");
AlgoVar[0] = 123;
...

// in the TMF
...
algo("XYZ");
var MySpecificValue = AlgoVar[0];
...

See also:

algo, asset, SaveMode, TradeVar

 

► latest version online