Trading Blox allows users to access order information in the script sections where the Object Order does not automatically have context by using the System's SetAlternateOrder function where each order is brought into context using the order's index value.

 

Once an order is in context, information about that order is made available using the Order Object's alternateOrder object prefix to access the properties and functions.  This next example shows a simple approach to accessing order information in script section where orders don't normally exist:

Example:

'  Loop over the open orders setting the order sort
'  value with a secret computation.
FOR orderIndex = 1 to system.totalOpenOrders STEP 1
  '  Bring order index by the 'orderIndex' Integer value.
  system.SetAlternateOrder( orderIndex )
  '  Change the order's sort value property to a random
  '  number between 1 and 100
  alternateOrder.SetSortValue( Random( 100 ) )
NEXT '  orderIndex

 

Once the order is in context other information can be accessed and changed as needed.

 

Notes:

Always check to be sure the order is available after a Broker function call using the system.orderExists() function prior to accessing it.

 

Using the alternateOrder object when orders are not in context will provide the same access as the Order object.  However, the alternateOrder object must be brought into context using the system.SetAlternateOrder object function prior to any attempt to use is properties and functions.

 

Once orders are brought into context their properties and function are available to reference or change.  

 


Edit Time: 5/12/2017 8:37:16 AM


Topic ID#: 147

 

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