OrderTicket Class (Component)
The OrderTicket component generates and sends an order ticket for a specified symbol from your EasyLanguage code. OrderTicket objects support a number of the order parameters (see below) that are available when manually placing an order from the TradeStation Order Bar. The status of all OrderTicket orders appear on the Orders tab of the TradeManager along with other regular orders.
Typically, you will use the Toolbox to add a component to your EasyLanguage document. Click and drag the name OrderTicket into your document from the Toolbox. The name of the provider appears in the component tray at the bottom of your document. By default, the name is followed by a number to identify multiple instances of the component.
Open the Properties editor and locate the properties under "General". You'll need to specify a symbol and account in the Symbols and Accounts fields as well as the order Action (Buy, Sell, etc.). Verify that the Quantity and other properties are as you intend before leaving the Properties editor. For example, Stop and Limit orders require that a typePrice or typePriceStyle and typePriceOffset be specified.
You can also set property values for a specific order object in EasyLanguage code, by assigning a value to OrderTicket1 followed by a 'dot operator' and an OrderTicket property name (including inherited properties).
OrderTicket1.Quantity=200; // changes the order Quantity to 200 shares.
After the order ticket is prepared in your EasyLanguage code, you place the order using the Send method (inherited from the OrderTicketBase class). To track the status of the order it's recommended that you save the sent order instance to an Order object variable. Be aware that an order will be generated each time the Send method is executed for an order ticket object, so you'll need to take care that your EasyLanguage code controls when each order ticket Send occurs (such as using Once as in the following example).
var: order MyOrder(null); // an order object variable will be used to save the sent order instance.
Once MyOrder = OrderTicket1.Send(); // send an order generated with the OrderTicket1 object and assign order to MyOrder.
It is strongly recommended that you fully test OrderTicket
with your Simulated Accounts
before using real Accounts. After inserting an indicator containing
an order object to an analysis window, you'll need to go to the Format-General tab and check Enable order placements objects
to allow orders to be sent from the indicator.
Namespace: tsdata.trading
Properties
Additional
properties, methods, and events are described in the classes listed
under Inheritance Hierarchy (see below).
Name | Type | Description | |
![]() |
Account | string | Sets or gets the ID of the account used for order placement. |
![]() |
Action | enum |
Sets or gets the order action. See OrderAction for a list of possible values.
In equities trading, all order actions (OrderAction.Buy, OrderAction.Sell, OrderAction.BuyToCover, and OrderAction.SellShort) can be used.
In options trading, the OrderAction values have the following meanings:
OrderAction.Buy = Buy to Open OrderAction.SellShort = Sell to Open OrderAction.BuyToCover = Buy to Close OrderAction.Sell = Sell to Close |
![]() |
ActionEx | string | The specific action detail type. |
![]() |
ActivationRules | object |
Sets or gets an ActivationRules object containing the rules collection for the order ticket. |
![]() |
AllOrNone | bool | True to allow the order to be placed only if the entire quantity can be placed. |
![]() |
BookOnly | bool | True restricts the order route your specify from re-routing your order to another destination. |
![]() |
BuyMinusSellPlus | bool | True to allow buys to occur only on downticks and sells only on upticks. |
![]() |
ConvertInvalidStopToMarket | bool | True sends the stop-market order directly to the TradeStation Order Execution Network's stop server where it is held. If active when the trigger conditions are met, a market order is issued. A native stop market is not issued, even if the execution destination natively supports stop-orders. |
![]() |
Discretionary | bool | True to indicate that you are willing to buy or sell at a price higher or lower than the bid or ask at which the order is placed. |
![]() |
DiscretionaryAmount | double | Sets or gets the discretionary price increment or decrement from the bid or ask when Discretionary is true. |
![]() |
Duration | string | Sets or gets the order duration. (eg. "DAY", "DAY+", "GTC", "GTC+", "GTD", "GTD+","FOK", "IOC","OPG", "1 Min", "3 Min", "5 Min" ) |
![]() |
Duration Date | datetime | Sets or gets a duration date for GTD. |
![]() |
ECNSweep | bool | Retained for backward compatibility |
![]() |
EndTime | datetime | Currently reserved for internal use. |
![]() |
ExecutionStyle | int | Currently reserved for internal use. |
![]() |
ExtendedProperties | object | The DynamicProperties object associated with the Order. |
![]() |
IfTouched | bool | True to specify a trigger price at which an order will be sent. |
![]() |
IfTouchedPrice | double | Sets or gets the trigger price at which an IfTouched order is sent. |
![]() |
IfTouchedPriceOffset | int | Sets or gets the IfTouched price offset value if using an 'auto' limit price style. |
![]() |
IfTouchedPriceStyle | enum | Sets or gets the IfTouched price style. See PriceStyle for a list of possible values. |
![]() |
LimitPrice | double | Sets or gets the limit price for a limit order. |
![]() |
LimitPriceOffset | int | Sets or gets the limit price offset value if using an 'auto' limit price style. |
![]() |
LimitPriceStyle | enum | Sets or gets the limit price style. See PriceStyle for a list of possible values. |
![]() |
MaxPercentVolume | int | Currently reserved for internal use. |
![]() |
MinPercentVolume | int | Currently reserved for internal use. |
![]() |
NonDisplay | bool | True indicates if the order price will not be reflected in Market Depth of ECN books. |
![]() |
OrderName | string | An optional, user-specified name for the order. Order names may not exceed 15 characters. The OrderName property of an OSOOrderTicket.PrimaryTicket will be automatically assigned if no OrderName is assigned by the EasyLanguage code. Note: OrderNames must be unique. No two OrderTickets should be assigned the same order name by your EasyLanguage code. |
![]() |
Peg | enum | Sets or gets a floating order price. See PegBehavior for a list of possible values. |
![]() |
PostOnly | bool | True means that the order will only add liquidity to the exchange, it will not remove liquidity or cause any other interaction.
![]() |
![]() |
Quantity | int | Sets or gets the quantity of shares or contracts for the order. |
![]() |
Route | string | Sets or gets the route for the order. |
![]() |
ShowOnly | bool | True to show only the specified quantity to the market instead of the full order quantity. |
![]() |
ShowOnlyQuantity | int | Sets of gets the specified quantity to display when ShowOnly is true. |
![]() |
StartTime | datetime | Currently reserved for internal use. |
![]() |
StopPrice | double | Sets or gets the stop price for a stop order. |
![]() |
StopPriceOffset | int | Sets or gets the stop price offset value if using an 'auto' stop price style. |
![]() |
StopPriceStyle | enum | Sets or gets the stop price style. See PriceStyle for a list of possible values. |
![]() |
Symbol | string | Sets or gets the symbol to trade. |
![]() |
SymbolType | enum | Sets or gets the security type of the symbol. See SecurityType for a list of possible values. |
![]() |
TrailingStop | enum | Sets or gets the type of trailing stop to use with a Stop Market order. See TrailingStopBehavior for a list of possible values.. |
![]() |
TrailingStopAmount | double | Sets or gets the amount to use when TrailingStop is set to points or percentage. |
![]() |
TriggerPrice | double | Reserved for future use. |
![]() |
|
enum | Sets or gets the order type. See OrderType for a list of possible values. |
Additional
properties, methods, and events are described in the classes listed
under Inheritance Hierarchy (see below).
Methods
Name | Description | |
![]() |
CancelAllOrders(account,symbol,dayOrdersOnly) | Requests cancellation of all orders for the specified account and symbol strings. Cancels only day orders if the third parameter is True. |
![]() |
CancelOrders(orderID) | Requests cancellation ofthe order having a specified ID string. |
![]() |
CancelOrders(standardFilter,extendedFilter,options) | Requests cancellation of existing orders based upon the parameters supplied |
![]() |
Clone | Duplicates Order. |
![]() |
ClosePosition(account,symbol) | Closes the current position for the specified account number and symbol strings. |
![]() |
Create | Creates a new instance of the class. |
![]() |
GetTradingSymbolFor(symbol,type) | Returns the tradeable symbol for a given symbol string and security type. See SecurityType for a list of possible values. |
![]() |
ReversePosition(account,symbol,templatePath) | Reverses position for the specified account and symbol using a order template file. |
![]() |
ReversePosition(account,symbol) | Reverses position for the specified account and symbol. |
Example
The following example uses an OrderTicket to send a Buy at Market order for the current stock symbol in a chart or symbol row when the SendOrder input is set to TRUE.
OrderTicketBuy indicator for RadarScreen or Chart Analysis with stock symbols |
- Click on the Import Example link to import the example into TradeStation.
- Go to the TradeStation platform and create a Chart Analysis or RadarScreen window containing symbols that you want to place orders for. Use the Insert - Indicator menu sequence and Add !ex_OrderTicketBuy to the Chart Analysis or RadarScreen window.
- Format the Indicator. On the General tab, check Enable order placement objects to allow orders to be placed from the indicator.
- Change the input iAccount1 to your account number. When ready, set the input PlaceOrderNow to TRUE to send the order.
- To review or modify the example code, go to the TS Development Environment and open indicator!ex_OrderTicketBuy in the EasyLanguage Editor.
Inheritance Hierarchy
tsdata.trading.OrderTicketBase
tsdata.trading.OrderTicket