Access to instrument's information in any of the script section is possible using this function.  When this function is used to access an instrument, it will bring the specified instrument's data into context so that its information is made available using a BPV variable name as an temporary instrument.  


This function is most often used in script sections that do not have automatic instrument context, but it can be used in script section that have automatic context when an additional instrument's information is needed.  Review the information in this table Blox Script Timing to see which script sections have automatic context, and which scripts require this function to access an instrument's data.


Instrument access can be to get data from another instrument in the portfolio, or to load a specified instrument that is not in the portfolio.  See the "symbolSpecifier" parameter information.

can be set using the symbol, the TYPE:symbol, or the portfolio's index for the target instrument.  Instrument can also be in another system that is listed in the suite being tested.  


You can access each instrument in each system to obtain its unique properties.  An instrument has many properties which are not unique across systems, like price and volume, but the trade properties and others are unique across systems and can be accessed by adding the system.index value of the system where the instrument is located (see example below).


Recommended that all instruments to be loaded are loaded once in the Before Test script, so that these instruments are set to the correct date when they are used. Subsequent calls to this function in the test will not reload the instrument, but just set the variable accordingly.



<BPVName>.LoadSymbol( symbolSpecifier [ or symbol ] [ or index ] [, system index] )





Symbol for the instrument with an optional market type prefix like: "F:GC" or "S:IBM"


Valid Prefixes:

'F:' - Futures
'S:' - Stocks
'FX:' - Forex



Each prefix uses the file location paths established in the Preference's Data Folders and Data Options setting for each of the data types.


Symbol information can use the path information as part of the symbol name.

i.e. File Drive and Folder Name: "C:\Data\Stocks\"

    Symbol-name file: "S:@GU6-I"


    CSI# named file: "S:S0052244"

        symbol = "C:\Data\Stocks\" + "S:@GU6-I"

[ or symbol ]

Symbol of the instrument like "S" or "AUDCAD"

[ or index ]

Index in the current portfolio.

[, system index]

Optional system index for the instrument to load.



'  Create a Block Permanent Instrument Object Variable called tempInstrument.

Click to Enlarge; Click to Reduce.

BPV Instrument Variable Type

VARIABLES: instrumentCount TYPE: Integer
'  Get the instrument count.
instrumentCount = system.totalInstruments
'  Loop printing the symbol for each instrument.
FOR index = 1 TO instrumentCount STEP 1
  '  Set the portfolio instrument.
   tempInstrument.LoadSymbol( index )
  '  Print out the file name.
  PRINT "Portfolio contains: ", tempInstrument.symbol
NEXT '  index

'  Create a Block Permanent Variable (BPV) called crudeOil.
'  This example assumes that the "CL" symbol is of the same type as the portfolio being tested:
'  Load the data for crude oil into the instrument
IF NOT crudeOil.LoadSymbol( "CL" ) THEN PRINT "Could not load CL"
'  While this example makes it explicit, that "CL" is of type Futures.
'  It is defined in the Futures Dictionary, and the data is in the Futures Data Folder.

'  Load the data for crude oil into the instrument
IF NOT crudeOil.LoadSymbol( "F:CL" ) THEN PRINT "Could not load CL"

'  Here we are loading a market index which could be used to validate market
'  trends before putting on a position.
'  The symbol of this instrument is "DJIA" and it is a stock.
IF NOT dowJoneIndustrials.LoadSymbol( "S:DJIA" ) THEN PRINT "Could not load DJIA"

'  To check if a loaded instrument is part of the system's portfolio,
'  check it's instrument.priorityIndex value.  When it is greater than 0, instrument

'  is in the portfolio. 

'  Access System in a different system in the suite

myInstrument.LoadSymbol( symbol, systemIndex )


Function returns = TRUE (1) when instrument load is successful and a FALSE (0) whwhen it fails to load an instrument.



Accessing Instruments, Instrument Loading, System Properties

See Also:

Instrument, system.index  


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

Topic ID#: 407

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