PlaceOrder (Function)
The PlaceOrder function can be called directly from EasyLanguage code for a study. Or code for a study can call one of the "wrapper" functions that, in turn, call this function (wrapper functions are noted in the "See Also" section, below).
This function issues the order entry macro .PlaceOrder (note the dot preceding the macro's name). The .PlaceOrder macro, like all other macros, can be issued from the platform's command line.
Syntax
PlaceOrder(OrderName, Frequency, Account, Action, SymbolCategory, MySymbol, Quantity, Duration, GTDDate, Route, AllOrNone, ByMinusSellPlus, Discretionary, ECNSweep, IfTouched, LimitPrice, NonDisplay, Peg, ShowOnly, StopPrice, TrailingAmount, TrailingType);
Returns
PlaceOrder returns 1 if called on a "real-time" tick and if a trade is allowed based on the user input "Frequency". The function returns -1 (negative one) in other cases; for example, if the function is called on an historical bar. If there are errors in the order parameters a runtime error message will be generated and the order will not be placed.
Parameters
String parameters must be enclosed in quotation marks. Numeric and Boolean values should not be in quotation marks.
Name |
Type |
Description |
Supported Values |
OrderName |
String |
Sets the order type. |
Limit, Market, LimitIfTouched, MarketIfTouched, StopMarket, StopLimit, or TrailingStop. Pass as a string (in quotation marks). |
Frequency |
String |
Sets the order frequency. |
Once, OncePerBar, EndOfBar, Always. Pass as a string (in quotation marks). |
Account |
String |
Sets the TradeStation account to be used for this order. |
Account number. Pass as a string (in quotation marks). |
Action |
String |
Sets the order action. |
Buy, Sell, SellShort, BuyToCover, BuyToOpen, BuyToClose, SellToOpen, or SellToClose. Pass as a string (in quotation marks). |
SymbolCategory |
String |
Sets the trading category for the symbol. |
Equity, Future, or EquityOption. Pass as a string (in quotation marks). |
MySymbol |
String |
Sets the symbol to be used for this order. |
The symbol to be traded. Pass as a string (in quotation marks). |
Quantity |
Numeric |
Sets the number of shares or contracts. |
Any number greater than zero. |
Duration |
String |
Sets the order duration. |
Day, Day+, GTC, GTC+, GTD, GTD+, IOC, FOK, OPG, 1Min, 3Min, or 5Min. Pass as a string (in quotation marks). |
GTDate |
String |
Sets the date, if appropriate, to be used with the specified duration. |
Date format is MM/DD/YY, as a string (in quotation marks). |
Route |
String |
Sets the order's route. |
Intelligent, AMEX, ARCX, BATS, BYX, CSFB, EDGA, EDGX, GIX, IEX, others. See the route drop down in the Trade Bar for the most current available routes. Pass as a string (in quotation marks). |
AllOrNone |
String |
Sets the all or none indication for the order. |
True or False, as a string (in quotation marks). |
BuyMinusSellPlus |
String |
Sets the buy minus/sell plus indication for the order. |
True or False, as a string (in quotation marks). |
Discretionary |
Numeric |
Causes the order to be discretionary or non-discretionary. |
Pass in 0 (zero) for non-discretionary orders. |
ECNSweep |
String |
Enables ECN sweep ("true") or does not enable ECN sweep ("false"). |
True or False, as a string (in quotation marks). |
IfTouched |
Numeric |
Determines whether the order is an if-touched order. |
Pass in 0 (zero) for orders that are not if-touched orders. |
LimitPrice |
Numeric |
Sets the limit price to be used for the order. |
Number |
NonDisplay |
String |
Enables non-display for the order ("true") or does not enable non-display ("false"). |
True or False, as a string (in quotation marks). |
Peg |
String |
Sets the peg indication for the order. |
False, Best, or Mid as a string (in quotation marks). |
ShowOnly |
Numeric |
Sets the show only indication for the order. |
Pass in 0 (zero) for orders that are not show only orders. |
StopPrice |
Numeric |
Sets the stop price to be used for the order. |
Number |
TrailingAmount |
Numeric |
Sets the trailing amount for the order. |
Pass in 0 (zero) for orders that are not trailing orders. |
TrailingType |
String |
Sets the trailing type of the order. |
If Peg is being used, this input must be set to " " (a blank space). Set this input to the string "MinMove", if trailing amount is to be specified as a number of minimum moves ("MinMoves", plural, is not valid). Enter "Pts", if trailing amount is to be specified in points. Enter "Pct", if trailing amount is to be specified as a percentage amount. |
See Also
LimitOrder, LimitIfTouchedOrder, MarketOrder, MarketIfTouchOrder, StopLimitOrder, StopMarketOrder, TrailingStopOrder