Continuing the discussion from How To - Use Optimize Value In Custom Metrics:
@Tomasz Would you kindly clarify (or provide a link to documentation) why it is necessary to use StaticVarSet and StaticVarGet to transfer an array from the first phase to the second phase of the backtest (status(“action”) == action Portfolio)?
The VarSet() online documentation states:
Dynamic variables are always global. Starting from version 6.10 the function accept matrix variables in addition to numbers and arrays.
While I realize now it is absolutely necessary to use Static Variables when transferring an array to the backtest phase 2, I want to better understand when I should use the regular dynamic variables (VarSet()) instead of static variables.
Incidentally, I believe that using VarSet() is more efficient because they do not persist (in memory) once my backtest or AFL formula is finished executing.
If I do use Static Variables in my custom backtest, should i clean them up someplace in the backtest formula? If yes, where is the correct location or backtest phase Status(“actionEX”) to place StaticVarRemove() function … in other words, is there a housekeeping phase that runs after all other custom backtest processing has finished?