Order Object

Top  Previous  Next

The Order object represents an order that either has just been filled or that might be filled depending on the values returned by a script.

 

Order Properties
Order Functions

 

The Order object is only available in the following scripts:


 


Entry Order Filled

 

called when an entry order has been filled

Exit Order Filled

 

called when an exit order has been filled

Can Add Unit

 

called when an entry order has triggered to allow filtering of orders based on risk limits

Can Fill Order

 

called when an order has triggered to allow custom fill handling

Unit Size


called when the broker object is used

 

 

The Order object can be used in the order scripts, and also in other scripts at certain times such as right after a successful broker call. Be sure it is clear what order is currently in context. To check if there is a valid order in the Order object, use the system.orderExists function prior to accessing it.

 

 

The alternateOrder object is the same as the order object, but it needs to be set to be used. To loop over all open orders one would set the alternateOrder object using the system.SetAlternateOrder function to access the properties of each order:

 

' Loop over the open orders setting the order sort value with a secret computation.

FOR orderIndex = 1 to system.totalOpenOrders STEP 1

 system.SetAlternateOrder( orderIndex )

 alternateOrder.SetSortValue( Random( 100 ) )

NEXT