1) To add the macro scripts to Analyzer, select the "Create custom variables, macros..." icon (
) in the main STK Analyzer window.
2) Click on "Init" under Current STK Scenario on the left. Copy all the VBScript text from the file "AnalyzerMacroTimeOffsetInitvbs.txt" located within the zip folder attached to this article and paste into the macro window.
3) Click on "PreRun" under Current STK Scenario. Copy all the VBScript text from the file "AnalyzerMacroTimeOffsetPreRunvbs.txt" and paste into the macro window.
4) Click OK to close the Macro window.
5) Now when you open a trade study tool you will see a custom TimeOffset variable that can be used as a design variable.
Final things to note:
1) You will see the TimeOffset variable is initialized with a value of zero. This is set on line 14 of the Init macro if you'd like to change it.
2) The TimeOffset variable is using Epoch Seconds as its unit. This is set on line 17 of the Init macro if you'd like to change it.
3) As the analysis start time of the scenario is incremented, the PreRun macro makes sure that the analysis stop time also increments forward. The scenario duration (time between scenario start and scenario stop) is set on line 16 of the PreRun macro.