.PlaceOrder Advanced Parameter

The .PlaceOrder command line macro includes advanced parameters that allow:

  • Creation of orders with OCO group or bracket associations
  • Naming of orders for OSO associations
  • Cancelling of named orders with the CancelOrder macro
  • Specifying a start time Activation Rule
  • Specifying price-based Activation Rules
  • Order protection from unwanted repeat issuance
  • Staging of orders for manual issuance from the TradeManager - Staged Orders tab

PlaceOrder functionality can be accessed through:

  • EasyLanguage functions like PlaceOrder command
  • .PlaceOrder strings sent by the EasyLanguage RunCommand reserved words
  • Custom macros via the Macros dialog, Toolbar buttons or Hot Keys
  • Manually entered or otherwise programmatically assembled and issued .PlaceOrder commands

Parameter Details

<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:

  • CancelOrder OrderName

Notes

  • CancelOrder will cancel all orders using the same OrderName, since multiple instances of an OrderName are allowed.
  • The OSOTriggerBy input below only links to the most recent order using the OrderName alias.
<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:

  • & for And
  • | for Or
  • Parentheses around the abbreviation for the Trigger Types for Activation Rules. Example: (SST)

Syntax details for ActivationPrices

The syntax for the ActivationPrices parameter is as follows (the parameter replicates the Activation Rule dialog price parameters available through Advanced order settings of the Trade Bar):

  • Start and end string with a single quote mark: '
  • Specify a symbol
  • Specify a comparison: >, <, >=, <=
  • Specify a value
  • Specify price trigger types for activation rules within parentheses, e.g. stt, sttn, sba, sab, dtt, dttn, dba, dab, ttt, tttn, tba, tab (see Order Entry Preferences - Triggers). Note the "N" is for "within NBBO" and not currently in list of trigger types in TradeStation Platform Help).
  • Link consecutive triggers with "and" logic using: &
  • Link consecutive triggers with "or" logic using: |
  • And/Or logic is sequential from left to right (top-down in dialog); for example:
           A and B or C and D or E

                is processed as

           ( ( ( A and B ) or C ) and D ) or E …
  • No spaces should be used in the ActivationPrices string, between numbers, symbols, trigger type designations and parentheses, or operators
  • Users should avoid long strings of triggering logic (more than 4 conditions is not recommended due to limited acceptable string lengths)
<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 and issuing the PlaceOrder string

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.

The One-by-One Paradigm

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 Trade 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.

Examples:(Advanced Parameters are Highlighted)

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:

OCO Bracket or Group, but not both

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.

Pairing Brackets

  • OCO Bracket orders exist only in pairs for the same symbol and with the same quantity. One side of the pair must be a limit order above market price for sells and below market price for buys. The other side of the pair must be a stop below market price for sells and above market price for buys. The first leg of a bracket is not restricted by pairing logic and is generally accepted. The second leg must be acceptable for pairing with the first leg or it will be rejected. Further, when a pair is established, subsequent orders with the same OCOBracketName will be rejected, unless one leg of the bracket is cancelled so that there is room for a replacement leg.
  • Can only link with Active or Queued orders within the Day's Trade Server Records.
  • Once an OCOGroupName has been used and filled or partially filled (leading to the cancellation of grouped orders), rejected or expired, that OCOGroupName can no longer be used until those order records are swept into history. Manual cancellation of orders using an OCOGroupName does not prevent further use of that OCOGroupName. However, manual cancellation does prevent the use of the name as an OCOBracketName.
  • Once an OCOBracketName has been used and filled or partially filled (leading to the cancellation or quantity adjustment of a paired leg), rejected or expired, that OCOBracketName can no longer be used until those order records are swept into history. Manual cancellation of orders using an OCOBracketName does not prevent further use of that OCOBracketName. However, manual cancellation does prevent the use of the name as an OCOGroupName.
  • Once an order with a given OrderName has been partially filled or filled, it cannot be referenced by the OSOTriggerBy parameter to create an OSO relationship. Trying to do so will cause an order to be rejected. However, the OrderName can be reused. The most recently placed order with the OrderName is the one used for OSO relationships.

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.