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.
Syntax: |
---|
<BPVName>.LoadSymbol( symbolSpecifier [ or symbol ] [ or index ] [, system index] ) |
Parameter: |
Description: |
---|---|
symbolSpecifier |
Symbol for the instrument with an optional market type prefix like: "F:GC" or "S:IBM"
Valid Prefixes: 'F:' - Futures
Note: 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" OR 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. |
Example: |
---|
' Create a Block Permanent Instrument Object Variable called tempInstrument. VARIABLES: instrumentCount TYPE: Integer ' Create a Block Permanent Variable (BPV) called crudeOil. ' Load the data for crude oil into the instrument ' Here we are loading a market index which could be used to validate market ' To check if a loaded instrument is part of the system's portfolio, ' is in the portfolio. ' Access System in a different system in the suite myInstrument.LoadSymbol( symbol, systemIndex ) |
Returns: |
---|
The tempInstrument variable returns = TRUE (1) when instrument load is successful; it returns a FALSE (0) when it fails to load an instrument. |
Links: |
---|
Accessing Instruments, Instrument Loading, System Properties |
See Also: |
Edit Time: 9/21/2020 2:37:28 PM |
Topic ID#: 407 |