StopMarketOrder (Function)
The StopMarketOrder function is used to configure and send a stop market order using the order entry macro .PlaceOrder. You can call this function directly from your own EasyLanguage code to simplify the formatting and generation of macro orders.
Care should be exercised when calling this function as it is intended to send live orders. Confirmations for macro-generated orders can be configured by using the File -> Preferences -> TradeStation Order Entry menu sequence.
Syntax
StopMarketOrder(Frequency,Account,Action,SymbolCategory,Symbol,Quantity,Duration,GTDDate,StopPrice)
Returns (Integer)
StopMarketOrder 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
Name |
Type |
Description |
Supported Values |
Frequency |
String |
Sets the order frequency. |
Once, OncePerBar, EndOfBar, Always |
Account |
String |
Sets the TradeStation account to be used for this order. |
Account string |
Action |
String |
Sets the order action. |
Buy, Sell, SellShort, BuyToCover, BuyToOpen, BuyToClose, SellToOpen, SellToClose |
SymbolCategory |
String |
Sets the trading category for the symbol. |
Equity, Future, Forex, EquityOption, FutureOption |
MySymbol |
String |
Sets the symbol to be used for this order. |
Symbol string |
Quantity |
Numeric |
Sets the number of shares, contracts, lots, etc. to be placed for this order. |
Number |
Duration |
String |
Sets the order duration. |
The following strings, when placed in quotation marks, are recognized by this function. However, the options that are supported by the order execution system vary by asset class and time of day (e.g., regular session or post-market). Day, Day+, GTC, GTC+, GTD, GTD+, IOC, FOK, OPG, 1Min, 3Min, 5Min |
GTDDate |
String |
Sets the date, if appropriate, to be used with the specified duration. |
Date Format (MM/DD/YY). |
StopPrice |
Numeric |
Sets the Stop price to be used for this order. |
Number |
Remarks
The StopMarketOrder function uses the PlaceOrder function to format the order parameters and call the order entry macro. The PlaceOrder function is only intended to be used by this and other designated TradeStation functions.
This function disables advanced order placement features (All or None, Buy on minus,Sell on plus, etc.).
See .PlaceOrder command for more information on using the order entry macro for placing orders.
Example
Places a sell order of 100 shares for MSFT at a stop price of $24.65 using the order entry macro .PlaceOrder. Value1 returns a 1 if the order is valid.
Value1 = StopMarketOrder("Once","SIM15180","Sell","Equity","MSFT",100,"Day","",24.65);
See Also
LimitIfTouchedOrder, LimitOrder, MarketIfTouchedOrder, MarketOrder, StopLimitOrder, TrailingStopOrder