All the information required to generate an order is contained in the Order Object's properties.  Information that can be changed before the order is executed, or rejected, can be handled by using one of the Order Object's functions.

Order Object:

Description:

Changing Orders

Information about when an order can be changed.

Creating Orders

Process of how orders are created.

Order Properties

When information is needed from an order use the properties listed in the Order Object properties table.

Order Functions

When information in an order needs to be changed, and that order has not been executed in the market, and it has not been rejected prior to being executed, use one of the functions listed in the Order Object function table.  Executed and rejected order disappear from the system and are not accessible.

 


All of the Order Object's properties using the Order prefix with a property or a function are only accessible in the following script sections.

Script Section:

Description:

Entry Orders

Signal orders only exists in this script section after a Broker Object function has been executed, and only when the order processing through the Unit Size and Can Add Unit script sections have not rejected the order.  To know if the order still exists, use the system.orderExists property.

Entry Order Filled

When an Entry Order has been successful filled, it arrives in this script section.

Exit Orders

Signal orders to affect an existing position for the symbol in context of this script section are created only after a Broker Object function has been executed.  

Exit Order Filled

Exit order execution to close a position, or change a position's size, this script is called with the results of order's fill information.

Can Add Unit

Only entry orders pass through this script so they can be adjusted, or rejected, for reasons other than risk or equity values.  

Can Fill Order

After all the available orders are executed on new data, this script is called for each instrument so custom requirements can be applied to the order's results.

Unit Size

This is where all new Entry orders are sent once a Broker Object function has been executed.  This script handles the chores associate with specifying the order's unit quantity.  Orders leaving this script with its order.continueProcessing flag still set to True are passed along to the Can Add Unit script section, if that script section exist in the system with scripted code.

 

Automatic Order Context Access:

Order object properties and functions are available in the Unit Size, Can Add Unit, and Can Fill Order script section where they get object context by default. They are also in context in the Entry Orders, and Exit Orders script section after a Broker function statement when the Broker initiated order has not been rejected.

 

An order is available when the system.orderExists () property returns a TRUE result after a Broker function statement returns execution from Unit Size and Can Add Unit script sections to the Entry Orders or Exit Orders script section.  

 

Note:

Orders are also in context in the Entry Orders Filled and Exit Orders Filled script section when those orders have been filled.

 

In all other script sections where an order does not have context, access to an order property or order function is possible when the AlternateOrder object process is used to bring the order object into context.  Order object must be in context by default or my using the AlternateOrder function.  When it is in context active order property information and functions can be accessed or executed to make changes.  

 

Do Not use the Order object in any of the script sections where it does not get automatic object context by default.

 


Accessing Order Functions and Properties:

Order-Type:

Description:

Entry

Broker-functions that create new Entry orders call the UNIT SIZE script. UNIT SIZE scripts are where order quantity is determined and assigned.  All orders that are intended to have an effect when it becomes a position must have a quantity.  

 

After an order is sized it can be processed through the CAN ADD UNIT script section when that script exists. CAN ADD UNIT script can apply filtering logic to determine if an order can be added to the system.  

 

Allowed order show their order.continueProcessing condition as TRUE.  Rejected orders because of size is too small, insufficient margin, cash, number of orders or positions, etc. show the order.continueProcessing condition set to FALSE.

 

Allowed orders are accessible in other script section once they are returned to Broker-Function that created the order.  To know if an order is available test the system.orderExists() function to see if it returns a TRUE state.

 

 

Exit

Broker-functions create Exit-Order without having to process the order through any other script section.

AdjustPosition

Orders to Add-Size or Reduce-Size are determined by the ratio value applied to these functions.  Values greater than 1 will increase quantity size, and value less than 1 will reduce size quantity.

 

All order that change order quantity size create the order directly and do not send the Broker transaction to any other script section.

 

Orders that increase size create Entry-Orders.  Orders that Reduce-Size create Exit-Orders. In both order type cases the order direction emulates the position direction that is being adjusted.

Order Context

When a script section doesn't normally have order context context can be created by using SetAlternateOrder function.

 

Alternate Order Object:

Access to Order Object properties and functions in other scripts is made possible by using the AlternateOrder Object as the prefix ahead of the "." property or function. AlternateOrder Object is discussed below.

 

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 and changes.

 

Links:

AlternateOrder Object, AlternateSystem Object, Order Functions, Order Object, Order Properties

See Also:

User's Guide Generating Orders

 


Edit Time: 9/25/2017 09:09:54 AM


Topic ID#: 103

 

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