Description Usage Arguments Details Value
initStrategy
will run a series of common initialization functions at the
beginning of an applyStrategy
call. This function allows the user to
add arbitrary initialization functions to the sequence.
1 2 |
strategy |
an object (or the name of an object) of type 'strategy' to add the init function definition to |
name |
name of the init, must correspond to an R function |
arguments |
named list of default arguments to be passed to an init function when executed |
parameters |
vector of strings naming parameters to be saved for apply-time definition,default NULL, only needed if you need special names to avoid argument collision |
label |
arbitrary text label for init output, default NULL |
... |
any other passthru parameters |
enabled |
TRUE/FALSE whether the init is enabled for use in applying the strategy, default TRUE |
indexnum |
if you are updating a specific init, the index number in the $init list to update |
store |
TRUE/FALSE whether to store the strategy in the .strategy environment, or return it. default FALSE |
These arbitrary functions will be added to the init
slot of the strategy object
and when applyStrategy
is evaluated, the arbitrary initialization functions will
be evaluated after the standardized functions.
For example, if your strategy uses a synthetic basket instrument, you could use this initialization slot to add a custom constructor to build the basket instrument time series and modify the symbols slot(s) of the strategy and portfolio.
if strategy
was the name of a strategy, the name. It it was a strategy, the updated strategy.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.