Access to an existing order is only possible when the script section can provide the order within the script's context.  Many script section normally have Order Object context.  See table: Blox Script Access.

 

Order Context is the normal a permission state enabled in a script section that allows direct Order Object access.   When order script does not normally provided direct Order Object access, it can be provided by using AlternateOrder Object for any active order access.

 

Syntax:

    system.SetAlternateOrder( [symbol], orderIndex )

 

Parameter:

Description:

[symbol]

Symbol is an optional parameter and can be omitted.  When used this function can bring order for a specific symbol into context and the index range to use should be within the range for a symbol shown in note #1.  

 

When all the orders are to be processed for possible changes, omit the symbol and use the index range shown in note #2.

 

Notes:

1.When used with a symbol in system.TotalOrders( [symbol] ) function the index index value must be one to the value returned by the system.TotalOrders( [symbol] ) function.

 

2.When used with system.totalOpenOrders property the index index value must be in the range of value returned by the system.totalOpenOrders property.

 

orderIndex

Any integer value must be one to the value returned by the returned by the TotalOpenOrders, or when a symbol value is return within the range of a symbol specific parameter with the TotalOrders function .

 

Example:

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  When Orders are available,...
If system.totalOpenOrders > 0 THEN
  '  Loop through orders to process volatility sizing
  For index = 1 TO system.totalOpenOrders STEP 1
 
    '  Bring this order record into Context
    system.SetAlternateOrder( index )
 
    '  Volatility Adjustments need a Std-Order Size to adjust
    If alternateOrder.quantity > 0 THEN
        PRINT test.currentDate, _
              sSymName, _  
              system.totalOpenOrders, _
             system.TotalOrders

 

        PRINT test.currentDate, _
              sSymName, _  
              system.totalOpenOrders, _
             system.TotalOrders(sSymName)

 
    ENDIF '  alternateOrder.quantity > 0
  Next '  index
ENDIF '  system.totalOpenOrders > 0
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Returns:

  '  Example Values When system.TotalOrders omits symbol:

t.cDate

sSymName

s.totalOpenOrders

s.TotalOrders

5/1/2014

SPY

5

5

5/1/2014

VTI

5

5

5/1/2014

XLB

5

5

5/1/2014

XLE

5

5

5/1/2014

XLK

5

5

 

  '  Example Values When system.TotalOrders uses symbol:

t.cDate

sSymName

s.totalOpenOrders

s.TotalOrders(sSymName)

5/1/2014

SPY

5

1

5/1/2014

VTI

5

1

5/1/2014

XLB

5

1

5/1/2014

XLE

5

1

5/1/2014

XLK

5

1

 

 

 


Edit Time: 4/6/2017 02:16:46 PM


Topic ID#: 530

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