TradeStation Help
The .PlaceOrder command line macro includes advanced parameters that allow:
PlaceOrder functionality can be accessed through:
<OrderName> | String {limited to 15 characters} |
The OrderName parameter assigns a name to an active order so that it can be referenced to trigger an OSO child. It can also be used to cancel specific orders with the CancelOrder macro as follows: OrderName that can be referenced by the following macros:
<OSOTriggerBy> | String {Refers to the OrderName of an existing open order} |
The OSOTriggerBy parameter specifies the parent order, by OrderName, that should trigger the OSO child order being created.
<OSO/GroupName> | String |
The OCOGroupName parameter tags the order being created with a Group Name that establishes order relationships where the filling of one order triggers the cancellation of all others in the group. See the OCO Order topic.
<OSOBracketName> | String |
The OCOBracketName parameter tags the order that appears in the TradeManager Group Name column, preceded by the "Brk " prefix. When matched with the same OCOBracketName of a prior order, a Bracket OCO Order can be created.
<StartTime> | String {hh:mm:ss AM/PM format} |
StartTime is an Activation Rules property (see the Placing an Order using Activation Rules topic) - Note that if a time is used that is prior to the order, and within an active trading session, the Start Time can immediately activate an order.
<ActivationPrices> | String |
ActivationPrices is an Activation Rules property (see the Placing an Order using Activation Rules topic) - These rules are encapsulated in a string without spaces, using:
Syntax for ActivationPrices parameter is as follows (the parameter replicates the Activation Rule dialog price parameters available through Advanced order settings of the Order Bar):
<MustBeUnique> | True, False |
MustBeUnique, when true, prevents repeat issuance of orders with the same OrderName as other orders in the day's trade server records. Note that orders already swept into the historical trade server are not checked when establishing uniqueness of the PlaceOrder OrderName.
<Stage> | True, False |
Stage, when true, specifies that the order be placed on the Staged Orders tab of TradeManager.
Constructing a PlaceOrder string can be involved due to the number of parameters and syntax requirements. For this reason, it is expected that users will need to construct strings with custom functions like PlaceOrder which issues the instructions to the macro command line through the EasyLanguage RunCommand reserved word. User can also construct pre-built command line Macros accessible from the Macro wizard, Hot Keys, and Toolbars.
PlaceOrder sends orders one by one. OSO and OCO Group or Bracket relationships are established within the TradeServer, rather than being pre-associated in an OCO & OSO Order Bar window. Because of this limitation, one should not attempt to establish an OSO relationship with a potentially filled order like a market order or limit order that is close to market prices. Such orders should not be used with PlaceOrder as OSO parents.
Command line strings:
.PlaceOrder "Symbol='SPY', SymbolCategory='Equity', account='SIM99999', action='Buy', Duration='Day', LimitPrice='28', OrderType='Limit', Quantity='100', OrderName='1stOrder', OCOGroupName='MyOCOGroup', StartTime='2:30:00 PM', ActivationPrices='IBM>=100.00(STT)&CSCO<24.00(STTN)|MSFT>25(DTT)', MustBeUnique='TRUE'"
.PlaceOrder "Symbol='SPY', SymbolCategory='Equity', account='SIM99999', action='Sell', Duration='Day', LimitPrice='30', OrderType='Limit', Quantity='100', OCOBracketName='1stBracket', OSOTriggerBy='1stOrder'"
.PlaceOrder "Symbol='SPY', SymbolCategory='Equity', account='SIM99999', action='Sell', Duration='Day', OrderType='Stop Market', Quantity='100', StopPrice='26', OCOBracketName='1stBracket', OSOTriggerBy='1stOrder'"
.PlaceOrder "Symbol='SPY', SymbolCategory='Equity', account='SIM99999', action='Buy', Duration='Day', OrderType='Stop Market', Quantity='100', StopPrice='32', OrderName='2ndOrder', OCOGroupName='MyOCOGroup', StartTime='2:30:00 PM', ActivationPrices='IBM>=100.00(STT)&CSCO<24.00(STTN)|MSFT>25(DTT)', MustBeUnique='TRUE'"
.PlaceOrder "Symbol='SPY', SymbolCategory='Equity', account='SIM99999', action='Sell', Duration='Day', LimitPrice='34', OrderType='Limit', Quantity='100', OCOBracketName='2ndBracket', OSOTriggerBy='2ndOrder'"
.PlaceOrder "Symbol='SPY', SymbolCategory='Equity', account='SIM99999', action='Sell', Duration='Day', OrderType='Stop Market', Quantity='100', StopPrice='30', OCOBracketName='2ndBracket', OSOTriggerBy='2ndOrder'"
Once executed, the status of each of the above orders will appear on separate rows in the TradeManager Order tab.
.PlaceOrder "Symbol='SPY', SymbolCategory='Equity', account='SIM99999', action='Sell', Duration='Day', OrderType='Market', Quantity='100', Stage='TRUE'"
Once executed, the staged order will appear in the TradeManager Staged Orders tab:
Orders can be part of either an OCO Bracket or OCO Group. They cannot be part of both. As shown above, a bracket can be created where the order quantity of the opposing legs are kept equivalent as one or the other side is filled. When the OCOGroupName input is used, many orders can be associated so that when one begins to fill, the other members of the group are cancelled. Using this feature can help minimize the effect on buying power when wanting multiple potential entry orders on the TradeStation Order Execution network simultaneously.
The OCOBracketName cannot be the same as a prior OCOGroupName in the day's trade server records. The reverse is also true, in that an OCOGroupName cannot be the same as a prior OCOBracketName. Such orders are rejected.
The sweeping of orders into history is a daily operation of the TradeStation Order Execution Network. This back-end operation typically occurs when there is not an active trading session or at times of low trading activity.