AlgoVar .. AlgoVar,
AlgoVar2 .. AlgoVar2
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 the 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 .. AssetVar
AssetStr .. AssetStr
8 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 variables are 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.
- Dependent on the SaveMode setting, the AlgoVars are automatically saved and loaded at the end and begin of trading. This way their values are preserved when a trading system is interrupted or restarted.
- When training or predicting with an R machine learning algorithm, AlgoVar..AlgoVar are sent over to R and can there be used for setting up parameters to the learning process.
- If saving and loading is not necessary, static series (with negative length) can be used instead of AlgoVars.
- The #define statement can be used for giving AlgoVars or AssetVars meaningful names, like #define MyVar AlgoVar. If an int is needed instead of a var, use the as_int() macro, like #define MyInt as_int(AlgoVar).
// in the run function
AlgoVar = 123;
// in the TMF
var MySpecificValue = AlgoVar;
algo, asset, SaveMode, TradeVar
► latest version online