The Before Simulation Script is run once for a simulation, even a simulation that includes many different parameter stepping tests. This script is often used to load external data which will be used for every test in a multi-parameter-step simulation:

 

The following is an example of a Before Simulation script:

 

VARIABLES: instrumentCount TYPE: Integer
VARIABLES: externalFileName TYPE: String
 
' Get the instrument count.
instrumentCount = system.totalInstruments
 
' Loop initializing each instrument.
FOR index = 1 TO instrumentCount STEP 1
 
  ' Set the portfolio instrument.
   portfolioInstrument.LoadSymbol( index )
 
  ' Get the symbol for the instrument.
   externalFileName = portfolioInstrument.symbol + "_ExternalData.csv"
 
  ' Print out the file name.
  PRINT "Loading External File: ", externalFileName
 
  ' Load the external data.
  IF NOT portfolioInstrument.LoadExternalData( externalFileName
          "BetaDate", "Beta1", "Beta2" ) THEN
      PRINT "Could not Load External Data for ", externalFileName
  ENDIF
NEXT

 

 

This example script loads external data by looking over the system's portfolio and then loading external files using the instrument's symbol.

 

This script does not have access to the test parameters, since it does not represent any one test. It is run before the first test is initialized.

 


Edit Time: 9/25/2017 09:09:56 AM


Topic ID#: 209

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software