AlternateBroker is also a Broker object with all the same functions and properties as the standard broker functions and properties. Use this method when the script does not by default have context for instrument access shown in Blox Script Access.
To use the AlternateBroker process the system where the AlternateBroker function are to be applied must first be brought into context. Context assignment is performed with the test.SetAlternateSystem function using the Suite's assigned system.index value (see line #4 in Example area).
When the alternateSystem object is set to the system number referenced, the AlternateBroker object is automatically sets to the same system.index value. This dual context-assignment allows orders to be placed for any system from any system, including from a Global Suite System (GSS).
In a GSS system instruments can be looped over and orders placed for any instrument in any or the systems in the suite. From a GSS, the instrument.symbol needs to be the first parameter used in the LoadSymbol function referenced (see line# 2 in Example area). This additional system index reference requirement after the symbol is necessary because the GSS has no default instrument context.
Here is an example of placing an order for Gold (GC) in System_1. This function call can be done from a GSS or any other system in the test, and it assumes GC is in the current portfolio for system 1.
"Mkt" in the example below is a BPV Instrument variable necessary to bring an instrument into context.
Example: |
---|
' Example loads Gold Future contract into the BPV instrument 'Mkt' |
Links: |
---|
See Also: |
|
Edit Time: 9/13/2020 3:40:23 PM |
Topic ID#: 145 |